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

Re: [PATCH] Link breaks for large NR_CPUS



On Nov 05, 2003  10:18 -0500, Martin Hicks wrote:
> Attatched is a patch that allows ext2 and ext3 to link correctly when
> the kernel is configured with a large NR_CPUS.  We do have an immediate
> need for this patch.
> 
> Any opinions on this?  The per-cpu lists are causing the kmalloc to fail
> due to allocating more than the max.

Given that the kmalloc limit is at least 128kB it seems that we would
start eating a fair chunk of our vmalloc space, which is a terrible thing
to waste since we don't really need contiguous address space for this.

Another option is to make s_dirs_counter, s_free*_counter, s_blockgroup_lock
all be pointers, and decide at compile time whether they will point to a
struct that is part of ext3_sb_info, or externally kmalloc'd.  Something like:

struct ext3_sb_info {
	:
	:
	struct percpu_counter *s_freeblocks_counter;
	struct percpu_counter *s_freeinodes_counter;
	struct percpu_counter *s_dirs_counter;
	struct blockgroup_lock *s_blockgroup_lock;
#if (NR_CPUS < 8) /* or whatever */
	struct percpu_counter s_freeblocks_counter_array;
	struct percpu_counter s_freeinodes_counter_array;
	struct percpu_counter s_dirs_counter_array;
	struct blockgroup_lock s_blockgroup_lock_array;
#endif
}


int ext3_fill_super()
{
	:
	:
	sbi = kmalloc(sizeof(*sbi), GFP_KERNEL);
#if (NR_CPUS < 8) /* see ext3_sb_info */
	sbi->s_freeblocks_counter = &sbi->s_freeblocks_counter_array;
	sbi->s_freeinodes_counter = &sbi->s_freeinodes_counter_array;
	sbi->s_dirs_counter = &sbi->s_dirs_counter_array;
	sbi->s_blockgroup_lock = &sbi->s_blockgroup_lock_array;
#else
	sbi->s_freenodes_counter = kmalloc(sizeof(*sbi->s_freenodes_counter);
	/* check if alloc OK, handle */
	percpu_counter_init(sbi->s_freenodes_counter);
	:
#endif
}

and then you need to change references to (&sbi->s_freeblocks_counter)
to be just (sbi->s_freeblocks_counter).

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/




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