linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] reiserfs: use __GFP_NOFAIL instead of yield and retry loop for allocation
@ 2006-01-13  7:33 Pekka J Enberg
  2006-01-13  7:42 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Pekka J Enberg @ 2006-01-13  7:33 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, reiserfs-dev

From: Pekka Enberg <penberg@cs.helsinki.fi>

This patch replaces yield and retry loop with __GFP_NOFAIL in
alloc_journal_list(). Compile-tested only.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---

 fs/reiserfs/journal.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Index: 2.6/fs/reiserfs/journal.c
===================================================================
--- 2.6.orig/fs/reiserfs/journal.c
+++ 2.6/fs/reiserfs/journal.c
@@ -2446,12 +2446,8 @@ static int journal_read(struct super_blo
 static struct reiserfs_journal_list *alloc_journal_list(struct super_block *s)
 {
 	struct reiserfs_journal_list *jl;
-      retry:
-	jl = kzalloc(sizeof(struct reiserfs_journal_list), GFP_NOFS);
-	if (!jl) {
-		yield();
-		goto retry;
-	}
+	jl = kzalloc(sizeof(struct reiserfs_journal_list),
+		     GFP_NOFS | __GFP_NOFAIL);
 	INIT_LIST_HEAD(&jl->j_list);
 	INIT_LIST_HEAD(&jl->j_working_list);
 	INIT_LIST_HEAD(&jl->j_tail_bh_list);

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

* Re: [PATCH] reiserfs: use __GFP_NOFAIL instead of yield and retry loop for allocation
  2006-01-13  7:33 [PATCH] reiserfs: use __GFP_NOFAIL instead of yield and retry loop for allocation Pekka J Enberg
@ 2006-01-13  7:42 ` Andrew Morton
  2006-01-13  7:46   ` Pekka J Enberg
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2006-01-13  7:42 UTC (permalink / raw)
  To: Pekka J Enberg; +Cc: linux-kernel, reiserfs-dev

Pekka J Enberg <penberg@cs.Helsinki.FI> wrote:
>
>  -      retry:
>  -	jl = kzalloc(sizeof(struct reiserfs_journal_list), GFP_NOFS);
>  -	if (!jl) {
>  -		yield();
>  -		goto retry;
>  -	}
>  +	jl = kzalloc(sizeof(struct reiserfs_journal_list),
>  +		     GFP_NOFS | __GFP_NOFAIL);

yup, that's what __GFP_NOFAIL is for: to consolidate and identify all those
places which want to lock up when we're short of memory...  They all need
fixing, really.

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

* Re: [PATCH] reiserfs: use __GFP_NOFAIL instead of yield and retry loop for allocation
  2006-01-13  7:42 ` Andrew Morton
@ 2006-01-13  7:46   ` Pekka J Enberg
  2006-01-13  7:55     ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Pekka J Enberg @ 2006-01-13  7:46 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, reiserfs-dev

Hi,

Pekka J Enberg <penberg@cs.Helsinki.FI> wrote:
> >
> >  -      retry:
> >  -	jl = kzalloc(sizeof(struct reiserfs_journal_list), GFP_NOFS);
> >  -	if (!jl) {
> >  -		yield();
> >  -		goto retry;
> >  -	}
> >  +	jl = kzalloc(sizeof(struct reiserfs_journal_list),
> >  +		     GFP_NOFS | __GFP_NOFAIL);

On Thu, 12 Jan 2006, Andrew Morton wrote:
> yup, that's what __GFP_NOFAIL is for: to consolidate and identify all those
> places which want to lock up when we're short of memory...  They all need
> fixing, really.

Out of curiosity, are there any potential problems with combining GFP_NOFS 
and __GFP_NOFAIL? Can we really guarantee to give out memory if we're not 
allowed to page out?

			Pekka

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

* Re: [PATCH] reiserfs: use __GFP_NOFAIL instead of yield and retry loop for allocation
  2006-01-13  7:46   ` Pekka J Enberg
@ 2006-01-13  7:55     ` Andrew Morton
  2006-01-13 21:44       ` Hans Reiser
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2006-01-13  7:55 UTC (permalink / raw)
  To: Pekka J Enberg; +Cc: linux-kernel, reiserfs-dev

Pekka J Enberg <penberg@cs.Helsinki.FI> wrote:
>
> Hi,
> 
> Pekka J Enberg <penberg@cs.Helsinki.FI> wrote:
> > >
> > >  -      retry:
> > >  -	jl = kzalloc(sizeof(struct reiserfs_journal_list), GFP_NOFS);
> > >  -	if (!jl) {
> > >  -		yield();
> > >  -		goto retry;
> > >  -	}
> > >  +	jl = kzalloc(sizeof(struct reiserfs_journal_list),
> > >  +		     GFP_NOFS | __GFP_NOFAIL);
> 
> On Thu, 12 Jan 2006, Andrew Morton wrote:
> > yup, that's what __GFP_NOFAIL is for: to consolidate and identify all those
> > places which want to lock up when we're short of memory...  They all need
> > fixing, really.
> 
> Out of curiosity, are there any potential problems with combining GFP_NOFS 
> and __GFP_NOFAIL? Can we really guarantee to give out memory if we're not 
> allowed to page out?
> 

GFP_NOFS increases the risk (relative to GFP_KERNEL) because page reclaim
can do less things than GFP_KERNEL to free memory.

GFP_NOFS allocations can still perform swapspace writes, however.  GFP_NOIO
cannot even do that.

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

* Re: [PATCH] reiserfs: use __GFP_NOFAIL instead of yield and retry loop for allocation
  2006-01-13  7:55     ` Andrew Morton
@ 2006-01-13 21:44       ` Hans Reiser
  0 siblings, 0 replies; 5+ messages in thread
From: Hans Reiser @ 2006-01-13 21:44 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Pekka J Enberg, linux-kernel, reiserfs-dev

Do you guys think you could write some nice long comments on these flags
regarding what they mean and the policies for using them?

I gotta tell you, lots of people end up just guessing as best as they can.

Hans

Andrew Morton wrote:

>Pekka J Enberg <penberg@cs.Helsinki.FI> wrote:
>  
>
>>Hi,
>>
>>Pekka J Enberg <penberg@cs.Helsinki.FI> wrote:
>>    
>>
>>>> -      retry:
>>>> -	jl = kzalloc(sizeof(struct reiserfs_journal_list), GFP_NOFS);
>>>> -	if (!jl) {
>>>> -		yield();
>>>> -		goto retry;
>>>> -	}
>>>> +	jl = kzalloc(sizeof(struct reiserfs_journal_list),
>>>> +		     GFP_NOFS | __GFP_NOFAIL);
>>>>        
>>>>
>>On Thu, 12 Jan 2006, Andrew Morton wrote:
>>    
>>
>>>yup, that's what __GFP_NOFAIL is for: to consolidate and identify all those
>>>places which want to lock up when we're short of memory...  They all need
>>>fixing, really.
>>>      
>>>
>>Out of curiosity, are there any potential problems with combining GFP_NOFS 
>>and __GFP_NOFAIL? Can we really guarantee to give out memory if we're not 
>>allowed to page out?
>>
>>    
>>
>
>GFP_NOFS increases the risk (relative to GFP_KERNEL) because page reclaim
>can do less things than GFP_KERNEL to free memory.
>
>GFP_NOFS allocations can still perform swapspace writes, however.  GFP_NOIO
>cannot even do that.
>
>
>  
>


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

end of thread, other threads:[~2006-01-13 21:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-13  7:33 [PATCH] reiserfs: use __GFP_NOFAIL instead of yield and retry loop for allocation Pekka J Enberg
2006-01-13  7:42 ` Andrew Morton
2006-01-13  7:46   ` Pekka J Enberg
2006-01-13  7:55     ` Andrew Morton
2006-01-13 21:44       ` Hans Reiser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).