linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][RFC]Ext4: Use get_cpu()/put_cpu() in preemptible context
       [not found]   ` <472BB037.5010606@linux.vnet.ibm.com>
@ 2007-11-03  0:35     ` Mingming Cao
  2007-11-03  5:01       ` Andreas Dilger
  0 siblings, 1 reply; 3+ messages in thread
From: Mingming Cao @ 2007-11-03  0:35 UTC (permalink / raw)
  To: ext4 development

Fix the warning of:

printk: 369 messages suppressed.
BUG: using smp_processor_id() in preemptible [00000001] code: fsx-linux/31702
caller is ext4_mb_new_blocks+0x2aa/0x1319

Signed-off-by: Mingming Cao <cmm@us.ibm.com>

---
 fs/ext4/mballoc.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.24-rc1/fs/ext4/mballoc.c
===================================================================
--- linux-2.6.24-rc1.orig/fs/ext4/mballoc.c	2007-11-02 17:22:18.000000000 -0700
+++ linux-2.6.24-rc1/fs/ext4/mballoc.c	2007-11-02 17:23:02.000000000 -0700
@@ -4006,7 +4006,8 @@ static void ext4_mb_group_or_file(struct
 		return;
 
 	BUG_ON(ac->ac_lg != NULL);
-	ac->ac_lg = &sbi->s_locality_groups[smp_processor_id()];
+	ac->ac_lg = &sbi->s_locality_groups[get_cpu()];
+	put_cpu();
 
 	/* we're going to use group allocation */
 	ac->ac_flags |= EXT4_MB_HINT_GROUP_ALLOC;

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

* Re: [PATCH][RFC]Ext4: Use get_cpu()/put_cpu() in preemptible context
  2007-11-03  0:35     ` [PATCH][RFC]Ext4: Use get_cpu()/put_cpu() in preemptible context Mingming Cao
@ 2007-11-03  5:01       ` Andreas Dilger
  2007-11-05 18:40         ` Mingming Cao
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Dilger @ 2007-11-03  5:01 UTC (permalink / raw)
  To: Mingming Cao; +Cc: ext4 development

On Nov 02, 2007  17:35 -0700, Mingming Cao wrote:
> Index: linux-2.6.24-rc1/fs/ext4/mballoc.c
> ===================================================================
> --- linux-2.6.24-rc1.orig/fs/ext4/mballoc.c	2007-11-02 17:22:18.000000000 -0700
> +++ linux-2.6.24-rc1/fs/ext4/mballoc.c	2007-11-02 17:23:02.000000000 -0700
> @@ -4006,7 +4006,8 @@ static void ext4_mb_group_or_file(struct
>  		return;
>  
>  	BUG_ON(ac->ac_lg != NULL);
> -	ac->ac_lg = &sbi->s_locality_groups[smp_processor_id()];
> +	ac->ac_lg = &sbi->s_locality_groups[get_cpu()];
> +	put_cpu();
>  
>  	/* we're going to use group allocation */
>  	ac->ac_flags |= EXT4_MB_HINT_GROUP_ALLOC;

Shouldn't the put_cpu() be after ac->ac_lg is no longer being used?
I guess there would otherwise be a danger of other processes using
the same s_locality_groups[] struct?

Cheers, Andreas
--
Andreas Dilger
Sr. Software Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

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

* Re: [PATCH][RFC]Ext4: Use get_cpu()/put_cpu() in preemptible context
  2007-11-03  5:01       ` Andreas Dilger
@ 2007-11-05 18:40         ` Mingming Cao
  0 siblings, 0 replies; 3+ messages in thread
From: Mingming Cao @ 2007-11-05 18:40 UTC (permalink / raw)
  To: Andreas Dilger; +Cc: ext4 development

On Sat, 2007-11-03 at 13:01 +0800, Andreas Dilger wrote:
> On Nov 02, 2007  17:35 -0700, Mingming Cao wrote:
> > Index: linux-2.6.24-rc1/fs/ext4/mballoc.c
> > ===================================================================
> > --- linux-2.6.24-rc1.orig/fs/ext4/mballoc.c	2007-11-02 17:22:18.000000000 -0700
> > +++ linux-2.6.24-rc1/fs/ext4/mballoc.c	2007-11-02 17:23:02.000000000 -0700
> > @@ -4006,7 +4006,8 @@ static void ext4_mb_group_or_file(struct
> >  		return;
> >  
> >  	BUG_ON(ac->ac_lg != NULL);
> > -	ac->ac_lg = &sbi->s_locality_groups[smp_processor_id()];
> > +	ac->ac_lg = &sbi->s_locality_groups[get_cpu()];
> > +	put_cpu();
> >  
> >  	/* we're going to use group allocation */
> >  	ac->ac_flags |= EXT4_MB_HINT_GROUP_ALLOC;
> 
> Shouldn't the put_cpu() be after ac->ac_lg is no longer being used?
> I guess there would otherwise be a danger of other processes using
> the same s_locality_groups[] struct?

>From the code, the concurrent use of the same s_locality_groups is being
protected by the ac_lg->lg_sem. The put_cpu() instruction is before the
lock is taken.


Mingming

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

end of thread, other threads:[~2007-11-05 18:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1Inx4A-0002PQ-00@kernel>
     [not found] ` <1194044898.3966.6.camel@localhost.localdomain>
     [not found]   ` <472BB037.5010606@linux.vnet.ibm.com>
2007-11-03  0:35     ` [PATCH][RFC]Ext4: Use get_cpu()/put_cpu() in preemptible context Mingming Cao
2007-11-03  5:01       ` Andreas Dilger
2007-11-05 18:40         ` Mingming Cao

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).