linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] slub: correct return errno on slab_sysfs_init failure
@ 2014-06-12 12:56 Jeff Liu
  2014-06-13  6:57 ` Pekka Enberg
  2014-06-13 15:53 ` Christoph Lameter
  0 siblings, 2 replies; 9+ messages in thread
From: Jeff Liu @ 2014-06-12 12:56 UTC (permalink / raw)
  To: linux-mm; +Cc: cl, penberg, mpm

From: Jie Liu <jeff.liu@oracle.com>

Return ENOMEM instead of ENOSYS if slab_sysfs_init() failed

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
 mm/slub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/slub.c b/mm/slub.c
index 2b1ce69..75ca109 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -5304,7 +5304,7 @@ static int __init slab_sysfs_init(void)
 	if (!slab_kset) {
 		mutex_unlock(&slab_mutex);
 		printk(KERN_ERR "Cannot register slab subsystem.\n");
-		return -ENOSYS;
+		return -ENOMEM;
 	}
 
 	slab_state = FULL;
-- 
1.8.3.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] slub: correct return errno on slab_sysfs_init failure
  2014-06-12 12:56 [PATCH] slub: correct return errno on slab_sysfs_init failure Jeff Liu
@ 2014-06-13  6:57 ` Pekka Enberg
  2014-06-14  7:44   ` Jeff Liu
  2014-06-13 15:53 ` Christoph Lameter
  1 sibling, 1 reply; 9+ messages in thread
From: Pekka Enberg @ 2014-06-13  6:57 UTC (permalink / raw)
  To: Jeff Liu; +Cc: linux-mm@kvack.org, Christoph Lameter, Matt Mackall,
	Andrew Morton

On Thu, Jun 12, 2014 at 3:56 PM, Jeff Liu <jeff.liu@oracle.com> wrote:
> From: Jie Liu <jeff.liu@oracle.com>
>
> Return ENOMEM instead of ENOSYS if slab_sysfs_init() failed
>
> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
> ---
>  mm/slub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index 2b1ce69..75ca109 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -5304,7 +5304,7 @@ static int __init slab_sysfs_init(void)
>         if (!slab_kset) {
>                 mutex_unlock(&slab_mutex);
>                 printk(KERN_ERR "Cannot register slab subsystem.\n");
> -               return -ENOSYS;
> +               return -ENOMEM;

What is the motivation for this change? AFAICT, kset_create_and_add()
can fail for other reasons than ENOMEM, no?

>         }
>
>         slab_state = FULL;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] slub: correct return errno on slab_sysfs_init failure
  2014-06-12 12:56 [PATCH] slub: correct return errno on slab_sysfs_init failure Jeff Liu
  2014-06-13  6:57 ` Pekka Enberg
@ 2014-06-13 15:53 ` Christoph Lameter
  2014-06-14  7:46   ` Jeff Liu
  1 sibling, 1 reply; 9+ messages in thread
From: Christoph Lameter @ 2014-06-13 15:53 UTC (permalink / raw)
  To: Jeff Liu; +Cc: linux-mm, penberg, mpm


On Thu, 12 Jun 2014, Jeff Liu wrote:

> From: Jie Liu <jeff.liu@oracle.com>
>
> Return ENOMEM instead of ENOSYS if slab_sysfs_init() failed

The reason that I used ENOSYS there is that the whole sysfs portion of the
slab allocator will be disabled. Could be due to a number of issues since
kset_create_and_add() returns NULL for any error.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] slub: correct return errno on slab_sysfs_init failure
  2014-06-13  6:57 ` Pekka Enberg
@ 2014-06-14  7:44   ` Jeff Liu
  0 siblings, 0 replies; 9+ messages in thread
From: Jeff Liu @ 2014-06-14  7:44 UTC (permalink / raw)
  To: Pekka Enberg
  Cc: linux-mm@kvack.org, Christoph Lameter, Matt Mackall,
	Andrew Morton


On 06/13/2014 14:57 PM, Pekka Enberg wrote:
> On Thu, Jun 12, 2014 at 3:56 PM, Jeff Liu <jeff.liu@oracle.com> wrote:
>> From: Jie Liu <jeff.liu@oracle.com>
>>
>> Return ENOMEM instead of ENOSYS if slab_sysfs_init() failed
>>
>> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
>> ---
>>  mm/slub.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/slub.c b/mm/slub.c
>> index 2b1ce69..75ca109 100644
>> --- a/mm/slub.c
>> +++ b/mm/slub.c
>> @@ -5304,7 +5304,7 @@ static int __init slab_sysfs_init(void)
>>         if (!slab_kset) {
>>                 mutex_unlock(&slab_mutex);
>>                 printk(KERN_ERR "Cannot register slab subsystem.\n");
>> -               return -ENOSYS;
>> +               return -ENOMEM;
> 
> What is the motivation for this change? AFAICT, kset_create_and_add()
> can fail for other reasons than ENOMEM, no?

Originally I'd like to make it consistent to most other subsystems which are
return ENOMEM in case of sysfs init failed, but yes, kset_register() can fail
due to different reaons...


Cheers,
-Jeff

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] slub: correct return errno on slab_sysfs_init failure
  2014-06-13 15:53 ` Christoph Lameter
@ 2014-06-14  7:46   ` Jeff Liu
  2014-06-16 14:00     ` Christoph Lameter
  0 siblings, 1 reply; 9+ messages in thread
From: Jeff Liu @ 2014-06-14  7:46 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: linux-mm, penberg, mpm


On 06/13/2014 23:53 PM, Christoph Lameter wrote:
> 
> On Thu, 12 Jun 2014, Jeff Liu wrote:
> 
>> From: Jie Liu <jeff.liu@oracle.com>
>>
>> Return ENOMEM instead of ENOSYS if slab_sysfs_init() failed
> 
> The reason that I used ENOSYS there is that the whole sysfs portion of the
> slab allocator will be disabled. Could be due to a number of issues since
> kset_create_and_add() returns NULL for any error.

Thanks for your clarification and sorry for the noise.

Cheers,
-Jeff

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] slub: correct return errno on slab_sysfs_init failure
  2014-06-14  7:46   ` Jeff Liu
@ 2014-06-16 14:00     ` Christoph Lameter
  2014-06-16 14:59       ` Jeff Liu
  0 siblings, 1 reply; 9+ messages in thread
From: Christoph Lameter @ 2014-06-16 14:00 UTC (permalink / raw)
  To: Jeff Liu; +Cc: linux-mm, penberg, mpm

On Sat, 14 Jun 2014, Jeff Liu wrote:

> Thanks for your clarification and sorry for the noise.

Dont be worried. I am not sure anymore that this was such a wise move.
Maybe get kset_create_and_add to return an error code instead and return
that instead of -ENOSYS?


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] slub: correct return errno on slab_sysfs_init failure
  2014-06-16 14:00     ` Christoph Lameter
@ 2014-06-16 14:59       ` Jeff Liu
  2014-06-16 15:25         ` Christoph Lameter
  0 siblings, 1 reply; 9+ messages in thread
From: Jeff Liu @ 2014-06-16 14:59 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: linux-mm, penberg, mpm


On 06/16/2014 22:00 PM, Christoph Lameter wrote:
> On Sat, 14 Jun 2014, Jeff Liu wrote:
> 
>> Thanks for your clarification and sorry for the noise.
> 
> Dont be worried. I am not sure anymore that this was such a wise move.
> Maybe get kset_create_and_add to return an error code instead and return
> that instead of -ENOSYS?

Personally, I prefer to get kset_create_and_add() to return an error which
can reflect the actual cause of the failure given that kset_register() can
failed due to different reasons.  If so, however, looks we have to make a
certain amount of change for the existing modules which are support sysfs
since they all return -ENOMEM if kset_create_and_add() return NULL, maybe
this is inherited from samples/kobject/kset-example.c...


Cheers,
-Jeff

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] slub: correct return errno on slab_sysfs_init failure
  2014-06-16 14:59       ` Jeff Liu
@ 2014-06-16 15:25         ` Christoph Lameter
  2014-06-16 15:31           ` Jeff Liu
  0 siblings, 1 reply; 9+ messages in thread
From: Christoph Lameter @ 2014-06-16 15:25 UTC (permalink / raw)
  To: Jeff Liu; +Cc: linux-mm, penberg, mpm

On Mon, 16 Jun 2014, Jeff Liu wrote:

> >
> > Dont be worried. I am not sure anymore that this was such a wise move.
> > Maybe get kset_create_and_add to return an error code instead and return
> > that instead of -ENOSYS?
>
> Personally, I prefer to get kset_create_and_add() to return an error which
> can reflect the actual cause of the failure given that kset_register() can
> failed due to different reasons.  If so, however, looks we have to make a
> certain amount of change for the existing modules which are support sysfs
> since they all return -ENOMEM if kset_create_and_add() return NULL, maybe
> this is inherited from samples/kobject/kset-example.c...

Probably. Could you come up with patchset to clean this up? ERR_PTR() can
be used to return an error code in a pointer value.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] slub: correct return errno on slab_sysfs_init failure
  2014-06-16 15:25         ` Christoph Lameter
@ 2014-06-16 15:31           ` Jeff Liu
  0 siblings, 0 replies; 9+ messages in thread
From: Jeff Liu @ 2014-06-16 15:31 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: linux-mm, penberg, mpm


On 06/16/2014 23:25 PM, Christoph Lameter wrote:
> On Mon, 16 Jun 2014, Jeff Liu wrote:
> 
>>>
>>> Dont be worried. I am not sure anymore that this was such a wise move.
>>> Maybe get kset_create_and_add to return an error code instead and return
>>> that instead of -ENOSYS?
>>
>> Personally, I prefer to get kset_create_and_add() to return an error which
>> can reflect the actual cause of the failure given that kset_register() can
>> failed due to different reasons.  If so, however, looks we have to make a
>> certain amount of change for the existing modules which are support sysfs
>> since they all return -ENOMEM if kset_create_and_add() return NULL, maybe
>> this is inherited from samples/kobject/kset-example.c...
> 
> Probably. Could you come up with patchset to clean this up? ERR_PTR() can
> be used to return an error code in a pointer value.

Sure, I'll work it out ASAP.


Cheers,
-Jeff

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-06-16 15:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-12 12:56 [PATCH] slub: correct return errno on slab_sysfs_init failure Jeff Liu
2014-06-13  6:57 ` Pekka Enberg
2014-06-14  7:44   ` Jeff Liu
2014-06-13 15:53 ` Christoph Lameter
2014-06-14  7:46   ` Jeff Liu
2014-06-16 14:00     ` Christoph Lameter
2014-06-16 14:59       ` Jeff Liu
2014-06-16 15:25         ` Christoph Lameter
2014-06-16 15:31           ` Jeff Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).