[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Ext2-devel] Re: [PATCH] Link breaks for large NR_CPUS

On Thu, 2003-11-06 at 14:39, Andreas Dilger wrote:
> On Nov 06, 2003  13:58 -0500, Martin Hicks wrote:
> > +static int ext3_setup_sbi (struct ext3_sb_info *sbi)
> > +{
> > +	sbi->s_freeblocks_counter = kmalloc(sizeof(struct percpu_counter), GFP_KERNEL);
> > +	if (!sbi->s_freeblocks_counter)
> > +		return -ENOMEM;
> > +	sbi->s_freeinodes_counter = kmalloc(sizeof(struct percpu_counter), GFP_KERNEL);
> > +	if (!sbi->s_freeinodes_counter)
> > +		goto out_freeblocks;
> > +	sbi->s_dirs_counter = kmalloc(sizeof(struct percpu_counter), GFP_KERNEL);
> Another poster mentioned alloc_percpu() which I wasn't aware of.  That might
> be preferrable if it does clever things like allocating out of per-cpu pages
> or something.  Sorry, I don't know the details of how to use it.

I think it's possible to use alloc_percpu().  The best way would be to
overhaul the percpu_counter structure to use alloc_percpu().  With just 
a quick inspection it looks like this would solve the kmalloc size
problems for a long time, although it would effect performance because
you do one kmalloc() per processor when you do alloc_percpu()

Let me take a look at that...

Martin Hicks                Wild Open Source Inc.
mort wildopensource com     613-266-2296

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]