mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mm/vmalloc.c: add a schedule point to vmalloc()
@ 2014-06-24 14:00 Eric Dumazet
  2014-06-24 22:18 ` David Rientjes
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2014-06-24 14:00 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Hugh Dickins, David Rientjes

From: Eric Dumazet <edumazet@google.com>

It is not uncommon on busy servers to get stuck hundred of ms in
vmalloc() calls (like file descriptor expansions).

Add a cond_resched() to __vmalloc_area_node() to be gentle to
other tasks.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: David Rientjes <rientjes@google.com>
---
 mm/vmalloc.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index f64632b67196..05a145ed1332 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1602,6 +1602,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
 			goto fail;
 		}
 		area->pages[i] = page;
+		cond_resched();
 	}
 
 	if (map_vm_area(area, prot, &pages))



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

* Re: [PATCH] mm/vmalloc.c: add a schedule point to vmalloc()
  2014-06-24 14:00 [PATCH] mm/vmalloc.c: add a schedule point to vmalloc() Eric Dumazet
@ 2014-06-24 22:18 ` David Rientjes
  2014-06-24 22:25   ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: David Rientjes @ 2014-06-24 22:18 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Andrew Morton, linux-kernel, Hugh Dickins

On Tue, 24 Jun 2014, Eric Dumazet wrote:

> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index f64632b67196..05a145ed1332 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -1602,6 +1602,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
>  			goto fail;
>  		}
>  		area->pages[i] = page;
> +		cond_resched();
>  	}
>  
>  	if (map_vm_area(area, prot, &pages))

Now that we pass the gfp mask into vmalloc() and all allocations aren't 
inherently GFP_KERNEL, I think this should only be done for (gfp_mask & 
__GFP_WAIT).

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

* Re: [PATCH] mm/vmalloc.c: add a schedule point to vmalloc()
  2014-06-24 22:18 ` David Rientjes
@ 2014-06-24 22:25   ` Andrew Morton
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2014-06-24 22:25 UTC (permalink / raw)
  To: David Rientjes; +Cc: Eric Dumazet, linux-kernel, Hugh Dickins

On Tue, 24 Jun 2014 15:18:57 -0700 (PDT) David Rientjes <rientjes@google.com> wrote:

> On Tue, 24 Jun 2014, Eric Dumazet wrote:
> 
> > diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> > index f64632b67196..05a145ed1332 100644
> > --- a/mm/vmalloc.c
> > +++ b/mm/vmalloc.c
> > @@ -1602,6 +1602,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
> >  			goto fail;
> >  		}
> >  		area->pages[i] = page;
> > +		cond_resched();
> >  	}
> >  
> >  	if (map_vm_area(area, prot, &pages))
> 
> Now that we pass the gfp mask into vmalloc() and all allocations aren't 
> inherently GFP_KERNEL, I think this should only be done for (gfp_mask & 
> __GFP_WAIT).

spose so.

--- a/mm/vmalloc.c~mm-vmallocc-add-a-schedule-point-to-vmalloc-fix
+++ a/mm/vmalloc.c
@@ -1602,7 +1602,8 @@ static void *__vmalloc_area_node(struct
 			goto fail;
 		}
 		area->pages[i] = page;
-		cond_resched();
+		if (gfp_mask & __GFP_WAIT)
+			cond_resched();
 	}
 
 	if (map_vm_area(area, prot, &pages))



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

end of thread, other threads:[~2014-06-24 22:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-24 14:00 [PATCH] mm/vmalloc.c: add a schedule point to vmalloc() Eric Dumazet
2014-06-24 22:18 ` David Rientjes
2014-06-24 22:25   ` Andrew Morton

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

all inboxes | Powered by JetHome®