On 06/20/2014 04:32 AM, Andrew Morton wrote: > On Thu, 19 Jun 2014 09:39:54 -0500 (CDT) Christoph Lameter <cl@xxxxxxxxxx> wrote: > >> On Wed, 18 Jun 2014, David Rientjes wrote: >> >>> Why? kset_create_and_add() can fail for a few other reasons other than >>> memory constraints and given that this is only done at bootstrap, it >>> actually seems like a duplicate name would be a bigger concern than low on >>> memory if another init call actually registered it. >> >> Greg said that the only reason for failure would be out of memory. > > The kset_create_and_add interface is busted - it should return an > ERR_PTR on error, not NULL. This seems to be a common gregkh failing :( > > It's plausible that out-of-memory is the most common reason for > kset_create_and_add() failure, dunno. > > Jeff, the changelog wasn't a good one - it failed to describe the > reasons for the change. What was wrong with ENOSYS and why is ENOMEM > more appropriate? If Greg told us that out-of-memory is the only > possible reason for the failure then it would be useful to capture the > reasoning behind this within this changelog. > > Also let's describe the effects of this patch. It looks like it's just > cosmetic - if kset_create_and_add() fails, the kernel behavior will be > the same either way. I admit that the current changelog is indistinct :) At that time, I thought it would be ENOMEM because I was review another patch for adding sysfs support to XFS where we return ENOMEM in this case: http://www.spinics.net/lists/xfs/msg28343.html This drives to me to think why it should be ENOMEM rather than ERR_PTR since it seems most likely kset_create_and_add() would fails due to other reasons. Hence I looked through kernel sources and figured out most subsystems are return ENOMEM, maybe those subsystems are refers to the kset example code at: samples/kobject/kset-example.c So my original motivation is just to make the slub sysfs init error handling in accordance to other subsystems(nitpick) and it does not affect the kernel behaviour. Combine with Greg's comments, as such, maybe the changelog would looks like the following? GregKH: the only reason for failure would be out of memory on kset_create_and_add(). return -ENOMEM than -ENOSYS if the call is failed which is consistent with other subsystems in this situation. Cheers, -Jeff -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>