Skip to contentSkip to conversation

Unusual code in mballoc.c.

DISCUSSION Rusty Russell 2 participants 2 messages Sep 28, 2008

lore
Share & tools
lore
#0 lore raw

Hi all,

A grep lead me to fs/ext4/mballoc.c:

Line 2551:

	for (i = 0; i < nr_cpu_ids; i++) {

This is more normally "for_each_possible_cpu(i)".

Line 4097:

	ac->ac_lg = &sbi->s_locality_groups[get_cpu()];
	put_cpu();

This is presumably someone suppressing a warning. It should be:

	ac->ac_lg = &sbi->s_locality_groups[raw_smp_processor_id()];

Thanks,
Rusty.

#1 lore raw
Quoted 10 lines · Rusty Russell

Hi all,

A grep lead me to fs/ext4/mballoc.c:

Line 2551:

	for (i = 0; i < nr_cpu_ids; i++) {

This is more normally "for_each_possible_cpu(i)".

Line 4097:

Quoted 8 lines
	ac->ac_lg = &sbi->s_locality_groups[get_cpu()];
	put_cpu();

This is presumably someone suppressing a warning. It should be:

	ac->ac_lg = &sbi->s_locality_groups[raw_smp_processor_id()];

Thanks,
Rusty.

Hi Rusty - I sent a patch for this a while back...

http://repo.or.cz/w/ext4-patch-queue.git?a=blob;f=ext4-use-percpu-data-for-lg_prealloc_list;h=8ddebb7f6054f70e34b142d7ae6f314d6629aac7;hb=HEAD

Thanks,
-Eric