public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* question on dup_task_struct
@ 2002-08-03 20:34 Oliver Neukum
  2002-08-03 22:22 ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Oliver Neukum @ 2002-08-03 20:34 UTC (permalink / raw)
  To: linux-kernel

Hi,

why is GFP_ATOMIC used in fork.c::dup_task_struct?

	TIA
		Oliver


	

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: question on dup_task_struct
  2002-08-03 20:34 question on dup_task_struct Oliver Neukum
@ 2002-08-03 22:22 ` Andrew Morton
  2002-08-03 22:29   ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2002-08-03 22:22 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: linux-kernel, Linus Torvalds

Oliver Neukum wrote:
> 
> Hi,
> 
> why is GFP_ATOMIC used in fork.c::dup_task_struct?

Presumably so that the allocation of the task structure can
dip into the emergency pools, giving fork a better chance
of succeeding?

We don't need to do that now - we can run page reclaim in
there as well as dip into the emergency pools.

 fork.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

--- 2.5.30/kernel/fork.c~fork-alloc	Sat Aug  3 15:19:10 2002
+++ 2.5.30-akpm/kernel/fork.c	Sat Aug  3 15:19:54 2002
@@ -106,9 +106,10 @@ static struct task_struct *dup_task_stru
 	struct thread_info *ti;
 
 	ti = alloc_thread_info();
-	if (!ti) return NULL;
+	if (!ti)
+		return NULL;
 
-	tsk = kmem_cache_alloc(task_struct_cachep,GFP_ATOMIC);
+	tsk = kmem_cache_alloc(task_struct_cachep, GFP_KERNEL|__GFP_HIGH);
 	if (!tsk) {
 		free_thread_info(ti);
 		return NULL;

.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: question on dup_task_struct
  2002-08-03 22:22 ` Andrew Morton
@ 2002-08-03 22:29   ` Andrew Morton
  2002-08-03 22:40     ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2002-08-03 22:29 UTC (permalink / raw)
  To: Oliver Neukum, linux-kernel, Linus Torvalds

Andrew Morton wrote:
> 
> Oliver Neukum wrote:
> >
> > Hi,
> >
> > why is GFP_ATOMIC used in fork.c::dup_task_struct?
> 
> Presumably so that the allocation of the task structure can
> dip into the emergency pools, giving fork a better chance
> of succeeding?

Or maybe it's to _make_ it fail, so we don't loop forever in
a 1-order allocation?

Let's find out, and add a comment, fer crissake.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: question on dup_task_struct
  2002-08-03 22:29   ` Andrew Morton
@ 2002-08-03 22:40     ` Andrew Morton
  2002-08-04  1:35       ` Linus Torvalds
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2002-08-03 22:40 UTC (permalink / raw)
  To: Oliver Neukum, linux-kernel, Linus Torvalds

Andrew Morton wrote:
> 
> Andrew Morton wrote:
> >
> > Oliver Neukum wrote:
> > >
> > > Hi,
> > >
> > > why is GFP_ATOMIC used in fork.c::dup_task_struct?
> >
> > Presumably so that the allocation of the task structure can
> > dip into the emergency pools, giving fork a better chance
> > of succeeding?
> 
> Or maybe it's to _make_ it fail, so we don't loop forever in
> a 1-order allocation?
> 

It's not a 1-order allocation.  I'll go back to sleep now.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: question on dup_task_struct
  2002-08-03 22:40     ` Andrew Morton
@ 2002-08-04  1:35       ` Linus Torvalds
  2002-08-04 13:42         ` Rik van Riel
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Torvalds @ 2002-08-04  1:35 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Oliver Neukum, linux-kernel



On Sat, 3 Aug 2002, Andrew Morton wrote:
>
> It's not a 1-order allocation.  I'll go back to sleep now.

According to slabinfo, it's an order-2 allocation at least on SMP-x86,
which is kind of sad. The object size is 1664 bytes, and the slab code
decides that putting two of them per page is too wasteful, so it
apparently puts 9 of them on 4 pages instead.

That does explain why it wants to dip into the low resources, but since
the VM for the last year or so tries hard to avoid allocation errors for
up to order-3 allocations the only thing that GFP_HIGH would add is to get
better latency at the cost of potentially being really nasty on the MM
balancing.

So I think it should be just GFP_KERNEL.

		Linus


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: question on dup_task_struct
  2002-08-04  1:35       ` Linus Torvalds
@ 2002-08-04 13:42         ` Rik van Riel
  0 siblings, 0 replies; 6+ messages in thread
From: Rik van Riel @ 2002-08-04 13:42 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Andrew Morton, Oliver Neukum, linux-kernel

On Sat, 3 Aug 2002, Linus Torvalds wrote:
> On Sat, 3 Aug 2002, Andrew Morton wrote:
> >
> > It's not a 1-order allocation.  I'll go back to sleep now.
>
> According to slabinfo, it's an order-2 allocation at least on SMP-x86,
> which is kind of sad. The object size is 1664 bytes, and the slab code
> decides that putting two of them per page is too wasteful, so it
> apparently puts 9 of them on 4 pages instead.

> So I think it should be just GFP_KERNEL.

Trying a little bit of active defragmentation for 4 and 8-page
allocations should be trivial with rmap.  If you want I could
take a stab at writing this code.

regards,

Rik
-- 
Bravely reimplemented by the knights who say "NIH".

http://www.surriel.com/		http://distro.conectiva.com/


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-08-04 13:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-03 20:34 question on dup_task_struct Oliver Neukum
2002-08-03 22:22 ` Andrew Morton
2002-08-03 22:29   ` Andrew Morton
2002-08-03 22:40     ` Andrew Morton
2002-08-04  1:35       ` Linus Torvalds
2002-08-04 13:42         ` Rik van Riel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox