2016-03-03 10:03:17

by Jan Stancek

[permalink] [raw]
Subject: [PATCH] mm/hugetlb: use EOPNOTSUPP in hugetlb sysctl handlers

Replace ENOTSUPP with EOPNOTSUPP. If hugepages are not supported,
this value is propagated to userspace. EOPNOTSUPP is part of uapi
and is widely supported by libc libraries.

Cc: Andrew Morton <[email protected]>
Cc: Naoya Horiguchi <[email protected]>
Cc: Mike Kravetz <[email protected]>
Cc: Hillf Danton <[email protected]>
Cc: "Kirill A. Shutemov" <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Paul Gortmaker <[email protected]>

Signed-off-by: Jan Stancek <[email protected]>
---
mm/hugetlb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 01f2b48c8618..851a29928a99 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2751,7 +2751,7 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
int ret;

if (!hugepages_supported())
- return -ENOTSUPP;
+ return -EOPNOTSUPP;

table->data = &tmp;
table->maxlen = sizeof(unsigned long);
@@ -2792,7 +2792,7 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write,
int ret;

if (!hugepages_supported())
- return -ENOTSUPP;
+ return -EOPNOTSUPP;

tmp = h->nr_overcommit_huge_pages;

--
1.8.3.1


2016-03-03 10:55:08

by Kirill A. Shutemov

[permalink] [raw]
Subject: Re: [PATCH] mm/hugetlb: use EOPNOTSUPP in hugetlb sysctl handlers

On Thu, Mar 03, 2016 at 11:02:51AM +0100, Jan Stancek wrote:
> Replace ENOTSUPP with EOPNOTSUPP. If hugepages are not supported,
> this value is propagated to userspace. EOPNOTSUPP is part of uapi
> and is widely supported by libc libraries.
>
> Cc: Andrew Morton <[email protected]>
> Cc: Naoya Horiguchi <[email protected]>
> Cc: Mike Kravetz <[email protected]>
> Cc: Hillf Danton <[email protected]>
> Cc: "Kirill A. Shutemov" <[email protected]>
> Cc: Dave Hansen <[email protected]>
> Cc: Paul Gortmaker <[email protected]>
>
> Signed-off-by: Jan Stancek <[email protected]>

Acked-by: Kirill A. Shutemov <[email protected]>

> ---
> mm/hugetlb.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 01f2b48c8618..851a29928a99 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -2751,7 +2751,7 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
> int ret;
>
> if (!hugepages_supported())
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
>
> table->data = &tmp;
> table->maxlen = sizeof(unsigned long);
> @@ -2792,7 +2792,7 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write,
> int ret;
>
> if (!hugepages_supported())
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
>
> tmp = h->nr_overcommit_huge_pages;
>
> --
> 1.8.3.1
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to [email protected]. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

--
Kirill A. Shutemov

2016-03-03 23:07:17

by Naoya Horiguchi

[permalink] [raw]
Subject: Re: [PATCH] mm/hugetlb: use EOPNOTSUPP in hugetlb sysctl handlers

On Thu, Mar 03, 2016 at 11:02:51AM +0100, Jan Stancek wrote:
> Replace ENOTSUPP with EOPNOTSUPP. If hugepages are not supported,
> this value is propagated to userspace. EOPNOTSUPP is part of uapi
> and is widely supported by libc libraries.
>
> Cc: Andrew Morton <[email protected]>
> Cc: Naoya Horiguchi <[email protected]>
> Cc: Mike Kravetz <[email protected]>
> Cc: Hillf Danton <[email protected]>
> Cc: "Kirill A. Shutemov" <[email protected]>
> Cc: Dave Hansen <[email protected]>
> Cc: Paul Gortmaker <[email protected]>
>
> Signed-off-by: Jan Stancek <[email protected]>

Acked-by: Naoya Horiguchi <[email protected]>

> ---
> mm/hugetlb.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 01f2b48c8618..851a29928a99 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -2751,7 +2751,7 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy,
> int ret;
>
> if (!hugepages_supported())
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
>
> table->data = &tmp;
> table->maxlen = sizeof(unsigned long);
> @@ -2792,7 +2792,7 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write,
> int ret;
>
> if (!hugepages_supported())
> - return -ENOTSUPP;
> + return -EOPNOTSUPP;
>
> tmp = h->nr_overcommit_huge_pages;
>
> --
> 1.8.3.1
>

2016-03-04 21:38:10

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] mm/hugetlb: use EOPNOTSUPP in hugetlb sysctl handlers

On Thu, 3 Mar 2016 11:02:51 +0100 Jan Stancek <[email protected]> wrote:

> Replace ENOTSUPP with EOPNOTSUPP. If hugepages are not supported,
> this value is propagated to userspace. EOPNOTSUPP is part of uapi
> and is widely supported by libc libraries.

hm, what is the actual user-visible effect of this change? Does it fix
some misbehaviour?


2016-03-05 08:10:14

by Jan Stancek

[permalink] [raw]
Subject: Re: [PATCH] mm/hugetlb: use EOPNOTSUPP in hugetlb sysctl handlers





----- Original Message -----
> From: "Andrew Morton" <[email protected]>
> To: "Jan Stancek" <[email protected]>
> Cc: [email protected], [email protected], [email protected], "mike kravetz"
> <[email protected]>, "hillf zj" <[email protected]>, "kirill shutemov"
> <[email protected]>, "dave hansen" <[email protected]>, "paul gortmaker"
> <[email protected]>
> Sent: Friday, 4 March, 2016 10:38:07 PM
> Subject: Re: [PATCH] mm/hugetlb: use EOPNOTSUPP in hugetlb sysctl handlers
>
> On Thu, 3 Mar 2016 11:02:51 +0100 Jan Stancek <[email protected]> wrote:
>
> > Replace ENOTSUPP with EOPNOTSUPP. If hugepages are not supported,
> > this value is propagated to userspace. EOPNOTSUPP is part of uapi
> > and is widely supported by libc libraries.
>
> hm, what is the actual user-visible effect of this change? Does it fix
> some misbehaviour?
>

It gives nicer message to user, rather than:
# cat /proc/sys/vm/nr_hugepages
cat: /proc/sys/vm/nr_hugepages: Unknown error 524

And also LTP's proc01 test was failing because this ret code (524)
was unexpected:
proc01 1 TFAIL : proc01.c:396: read failed: /proc/sys/vm/nr_hugepages: errno=???(524): Unknown error 524
proc01 2 TFAIL : proc01.c:396: read failed: /proc/sys/vm/nr_hugepages_mempolicy: errno=???(524): Unknown error 524
proc01 3 TFAIL : proc01.c:396: read failed: /proc/sys/vm/nr_overcommit_hugepages: errno=???(524): Unknown error 524

Regards,
Jan

2016-03-07 22:18:18

by David Rientjes

[permalink] [raw]
Subject: Re: [PATCH] mm/hugetlb: use EOPNOTSUPP in hugetlb sysctl handlers

On Thu, 3 Mar 2016, Jan Stancek wrote:

> Replace ENOTSUPP with EOPNOTSUPP. If hugepages are not supported,
> this value is propagated to userspace. EOPNOTSUPP is part of uapi
> and is widely supported by libc libraries.
>
> Cc: Andrew Morton <[email protected]>
> Cc: Naoya Horiguchi <[email protected]>
> Cc: Mike Kravetz <[email protected]>
> Cc: Hillf Danton <[email protected]>
> Cc: "Kirill A. Shutemov" <[email protected]>
> Cc: Dave Hansen <[email protected]>
> Cc: Paul Gortmaker <[email protected]>
>
> Signed-off-by: Jan Stancek <[email protected]>

Acked-by: David Rientjes <[email protected]>

2016-03-08 00:13:29

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] mm/hugetlb: use EOPNOTSUPP in hugetlb sysctl handlers

On Sat, 5 Mar 2016 03:09:50 -0500 (EST) Jan Stancek <[email protected]> wrote:

> > > Replace ENOTSUPP with EOPNOTSUPP. If hugepages are not supported,
> > > this value is propagated to userspace. EOPNOTSUPP is part of uapi
> > > and is widely supported by libc libraries.
> >
> > hm, what is the actual user-visible effect of this change? Does it fix
> > some misbehaviour?
> >
>
> It gives nicer message to user, rather than:
> # cat /proc/sys/vm/nr_hugepages
> cat: /proc/sys/vm/nr_hugepages: Unknown error 524
>
> And also LTP's proc01 test was failing because this ret code (524)
> was unexpected:
> proc01 1 TFAIL : proc01.c:396: read failed: /proc/sys/vm/nr_hugepages: errno=???(524): Unknown error 524
> proc01 2 TFAIL : proc01.c:396: read failed: /proc/sys/vm/nr_hugepages_mempolicy: errno=???(524): Unknown error 524
> proc01 3 TFAIL : proc01.c:396: read failed: /proc/sys/vm/nr_overcommit_hugepages: errno=???(524): Unknown error 524
>

Ah, OK, thanks. "Unknown error 524" is rather rude. I'll queue this
for 4.5.

2016-03-08 03:08:42

by Hillf Danton

[permalink] [raw]
Subject: Re: [PATCH] mm/hugetlb: use EOPNOTSUPP in hugetlb sysctl handlers

>
> On Thu, 3 Mar 2016, Jan Stancek wrote:
>
> > Replace ENOTSUPP with EOPNOTSUPP. If hugepages are not supported,
> > this value is propagated to userspace. EOPNOTSUPP is part of uapi
> > and is widely supported by libc libraries.
> >
> > Cc: Andrew Morton <[email protected]>
> > Cc: Naoya Horiguchi <[email protected]>
> > Cc: Mike Kravetz <[email protected]>
> > Cc: Hillf Danton <[email protected]>
> > Cc: "Kirill A. Shutemov" <[email protected]>
> > Cc: Dave Hansen <[email protected]>
> > Cc: Paul Gortmaker <[email protected]>
> >
> > Signed-off-by: Jan Stancek <[email protected]>
>
Acked-by: Hillf Danton <[email protected]>