__init in mm/slab.c
A message that is not in the archive (sent off-list or not yet received): [email protected]
From the bk commit log:
Quoted 8 lines
ChangeSet 1.2132, 2004/11/13 20:59:55-08:00, [email protected]
[PATCH]
__initinmm/slab.cThe below removes an
__initdata
(forinitarray_genericthat is referenced in non-init code).
I think the patch is wrong and should be reverted: initarray_generic is referenced, but never used:
Quoted 11 lines
if (g_cpucache_up == NONE) { /* Note: the first kmem_cache_create must create * the cache that's used by kmalloc(24), otherwise * the creation of further caches will BUG(). */ cachep->array[smp_processor_id()] = &initarray_generic.cache; g_cpucache_up = PARTIAL; } else { cachep->array[smp_processor_id()] = kmalloc(sizeof(structarraycache_init),GFP_KERNEL);
}
g_cpucache_up is NONE during bootstrap and FULL after boot. Thus the initarray is never accessed after boot.
Andries, why did you propose this change? Does the current code trigger an automatic test?
--
Manfred
Quoted 5 lines · Manfred Spraul
g_cpucache_upis NONE during bootstrap and FULL after boot. Thus the initarray is never accessed after boot.Andries, why did you propose this change? Does the current code trigger an automatic test?
Yes. I was a bit more explicit in the timer patch:
"The i386 timers use a struct timer_opts that has a field init pointing at a __init function. The rest of the struct is not __init. Nothing is wrong, but if we want to avoid having references to init stuff in non-init sections, some reshuffling is needed."
So yesterday's series of __init patches is not because there were bugs, but because it is desirable to have the situation where static inspection of the object code shows absence of references to .init stuff. Much better than having to reason that there is a reference but that it will not be used.
Where the memory win is important the code should be rewritten a bit.
Andries
Quoted 6 lines · Andries Brouwer
So yesterday's series of
__initpatches is not because there were bugs, but because it is desirable to have the situation where static inspection of the object code shows absence of references to .init stuff. Much better than having to reason that there is a reference but that it will not be used.
And I agree heartily with this. I love static checking (after all, that's all that sparse does), and if you can make sure that there is one less thing to be worried about, all the better.
Of course, another option to just removing/fixing the __init is to have some way to let the static checker know things are ok, but in this case, especially with fairly small data structures, it seems much easier to just make the checker happy.
Linus
Quoted 11 lines · Linus Torvalds
Quoted 7 lines · Andries Brouwer
So yesterday's series of
__initpatches is not because there were bugs, but because it is desirable to have the situation where static inspection of the object code shows absence of references to .init stuff. Much better than having to reason that there is a reference but that it will not be used.
Quoted 6 lines
And I agree heartily with this. I love static checking (after all, that's all that sparse does), and if you can make sure that there is one less thing to be worried about, all the better.
Of course, another option to just removing/fixing the
__initis to have some way to let the static checker know things are ok, but in this case, especially with fairly small data structures, it seems much easier to just make the checker happy.
I agree, but a comment would have been nice. Now there are two identical structures that are used for the same purpose, one __init, one not __init.
I'd bet that sooner or later someone will ask why.
--
Manfred