linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/4] mm,hugetlb: compute page_size_log properly
       [not found] <1486673582-6979-1-git-send-email-dave@stgolabs.net>
@ 2017-02-09 20:53 ` Davidlohr Bueso
  2017-02-10 10:20   ` Michal Hocko
  0 siblings, 1 reply; 6+ messages in thread
From: Davidlohr Bueso @ 2017-02-09 20:53 UTC (permalink / raw)
  To: akpm; +Cc: manfred, dave, linux-kernel, linux-mm, Davidlohr Bueso

The SHM_HUGE_* stuff  was introduced in:

   42d7395feb5 (mm: support more pagesizes for MAP_HUGETLB/SHM_HUGETLB)

It unnecessarily adds another layer, specific to sysv shm, without
anything special about it: the macros are identical to the MAP_HUGE_*
stuff, which in turn does correctly describe the hugepage subsystem.

One example of the problems with extra layers what this patch fixes:
mmap_pgoff() should never be using SHM_HUGE_* logic. It is obviously
harmless but it would still be grand to get rid of it -- although
now in the manpages I don't see that happening.

Cc: linux-mm@kvack.org
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
 mm/mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 499b988b1639..40b29aca18c1 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1479,7 +1479,7 @@ SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
 		struct user_struct *user = NULL;
 		struct hstate *hs;
 
-		hs = hstate_sizelog((flags >> MAP_HUGE_SHIFT) & SHM_HUGE_MASK);
+		hs = hstate_sizelog((flags >> MAP_HUGE_SHIFT) & MAP_HUGE_MASK);
 		if (!hs)
 			return -EINVAL;
 
-- 
2.6.6

--
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] 6+ messages in thread

* Re: [PATCH 4/4] mm,hugetlb: compute page_size_log properly
  2017-02-09 20:53 ` [PATCH 4/4] mm,hugetlb: compute page_size_log properly Davidlohr Bueso
@ 2017-02-10 10:20   ` Michal Hocko
  2017-02-10 16:51     ` Davidlohr Bueso
  0 siblings, 1 reply; 6+ messages in thread
From: Michal Hocko @ 2017-02-10 10:20 UTC (permalink / raw)
  To: Davidlohr Bueso; +Cc: akpm, manfred, linux-kernel, linux-mm, Davidlohr Bueso

On Thu 09-02-17 12:53:02, Davidlohr Bueso wrote:
> The SHM_HUGE_* stuff  was introduced in:
> 
>    42d7395feb5 (mm: support more pagesizes for MAP_HUGETLB/SHM_HUGETLB)
> 
> It unnecessarily adds another layer, specific to sysv shm, without
> anything special about it: the macros are identical to the MAP_HUGE_*
> stuff, which in turn does correctly describe the hugepage subsystem.
> 
> One example of the problems with extra layers what this patch fixes:
> mmap_pgoff() should never be using SHM_HUGE_* logic. It is obviously
> harmless but it would still be grand to get rid of it -- although
> now in the manpages I don't see that happening.

Can we just drop SHM_HUGE_MASK altogether? It is not exported in uapi
headers AFAICS.

> 
> Cc: linux-mm@kvack.org
> Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
> ---
>  mm/mmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 499b988b1639..40b29aca18c1 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -1479,7 +1479,7 @@ SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
>  		struct user_struct *user = NULL;
>  		struct hstate *hs;
>  
> -		hs = hstate_sizelog((flags >> MAP_HUGE_SHIFT) & SHM_HUGE_MASK);
> +		hs = hstate_sizelog((flags >> MAP_HUGE_SHIFT) & MAP_HUGE_MASK);
>  		if (!hs)
>  			return -EINVAL;
>  
> -- 
> 2.6.6
> 
> --
> 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>

-- 
Michal Hocko
SUSE Labs

--
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] 6+ messages in thread

* Re: [PATCH 4/4] mm,hugetlb: compute page_size_log properly
  2017-02-10 10:20   ` Michal Hocko
@ 2017-02-10 16:51     ` Davidlohr Bueso
  2017-02-20 16:11       ` Michal Hocko
  0 siblings, 1 reply; 6+ messages in thread
From: Davidlohr Bueso @ 2017-02-10 16:51 UTC (permalink / raw)
  To: Michal Hocko; +Cc: akpm, manfred, linux-kernel, linux-mm, Davidlohr Bueso

On Fri, 10 Feb 2017, Michal Hocko wrote:

>On Thu 09-02-17 12:53:02, Davidlohr Bueso wrote:
>> The SHM_HUGE_* stuff  was introduced in:
>>
>>    42d7395feb5 (mm: support more pagesizes for MAP_HUGETLB/SHM_HUGETLB)
>>
>> It unnecessarily adds another layer, specific to sysv shm, without
>> anything special about it: the macros are identical to the MAP_HUGE_*
>> stuff, which in turn does correctly describe the hugepage subsystem.
>>
>> One example of the problems with extra layers what this patch fixes:
>> mmap_pgoff() should never be using SHM_HUGE_* logic. It is obviously
>> harmless but it would still be grand to get rid of it -- although
>> now in the manpages I don't see that happening.
>
>Can we just drop SHM_HUGE_MASK altogether? It is not exported in uapi
>headers AFAICS.

Yeah that was my original idea, however I noticed that shmget.2 mentions
kernel internals as part of SHM_HUGE_{2MB,1GB}, ie: SHM_HUGE_SHIFT. So
dropping _MASK doesn't make sense if we are going to keep _SHIFT.

Thanks,
Davidlohr

--
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] 6+ messages in thread

* Re: [PATCH 4/4] mm,hugetlb: compute page_size_log properly
  2017-02-10 16:51     ` Davidlohr Bueso
@ 2017-02-20 16:11       ` Michal Hocko
  2017-02-22 16:03         ` Davidlohr Bueso
  0 siblings, 1 reply; 6+ messages in thread
From: Michal Hocko @ 2017-02-20 16:11 UTC (permalink / raw)
  To: Davidlohr Bueso; +Cc: akpm, manfred, linux-kernel, linux-mm, Davidlohr Bueso

Sorry for a late reply, I wasn't online last week

On Fri 10-02-17 08:51:11, Davidlohr Bueso wrote:
> On Fri, 10 Feb 2017, Michal Hocko wrote:
> 
> > On Thu 09-02-17 12:53:02, Davidlohr Bueso wrote:
> > > The SHM_HUGE_* stuff  was introduced in:
> > > 
> > >    42d7395feb5 (mm: support more pagesizes for MAP_HUGETLB/SHM_HUGETLB)
> > > 
> > > It unnecessarily adds another layer, specific to sysv shm, without
> > > anything special about it: the macros are identical to the MAP_HUGE_*
> > > stuff, which in turn does correctly describe the hugepage subsystem.
> > > 
> > > One example of the problems with extra layers what this patch fixes:
> > > mmap_pgoff() should never be using SHM_HUGE_* logic. It is obviously
> > > harmless but it would still be grand to get rid of it -- although
> > > now in the manpages I don't see that happening.
> > 
> > Can we just drop SHM_HUGE_MASK altogether? It is not exported in uapi
> > headers AFAICS.
> 
> Yeah that was my original idea, however I noticed that shmget.2 mentions
> kernel internals as part of SHM_HUGE_{2MB,1GB}, ie: SHM_HUGE_SHIFT. So
> dropping _MASK doesn't make sense if we are going to keep _SHIFT.

I am not sure I understand.
$ git grep SHM_HUGE_ include/uapi/
$

So there doesn't seem to be any user visible constant. The man page
mentiones is but I do not really see how is the userspace supposed to
use it.
-- 
Michal Hocko
SUSE Labs

--
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] 6+ messages in thread

* Re: [PATCH 4/4] mm,hugetlb: compute page_size_log properly
  2017-02-20 16:11       ` Michal Hocko
@ 2017-02-22 16:03         ` Davidlohr Bueso
  2017-02-22 16:11           ` Michal Hocko
  0 siblings, 1 reply; 6+ messages in thread
From: Davidlohr Bueso @ 2017-02-22 16:03 UTC (permalink / raw)
  To: Michal Hocko; +Cc: akpm, manfred, linux-kernel, linux-mm, Davidlohr Bueso

On Mon, 20 Feb 2017, Michal Hocko wrote:

>I am not sure I understand.
>$ git grep SHM_HUGE_ include/uapi/
>$
>
>So there doesn't seem to be any user visible constant. The man page
>mentiones is but I do not really see how is the userspace supposed to
>use it.

Yeah, userspace is not supposed to use it, it's just there because
the manpage describes kernel internals. I'm not really a big fan
of touching manpages (and ipc is already full of corner cases),
but I guess nobody can really complain if we rip out all the
SHM_HUGE_ stuff.

Thanks,
Davidlohr

--
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] 6+ messages in thread

* Re: [PATCH 4/4] mm,hugetlb: compute page_size_log properly
  2017-02-22 16:03         ` Davidlohr Bueso
@ 2017-02-22 16:11           ` Michal Hocko
  0 siblings, 0 replies; 6+ messages in thread
From: Michal Hocko @ 2017-02-22 16:11 UTC (permalink / raw)
  To: Davidlohr Bueso; +Cc: akpm, manfred, linux-kernel, linux-mm, Davidlohr Bueso

On Wed 22-02-17 08:03:19, Davidlohr Bueso wrote:
> On Mon, 20 Feb 2017, Michal Hocko wrote:
> 
> > I am not sure I understand.
> > $ git grep SHM_HUGE_ include/uapi/
> > $
> > 
> > So there doesn't seem to be any user visible constant. The man page
> > mentiones is but I do not really see how is the userspace supposed to
> > use it.
> 
> Yeah, userspace is not supposed to use it, it's just there because
> the manpage describes kernel internals.

Which is wrong!

> I'm not really a big fan
> of touching manpages (and ipc is already full of corner cases),
> but I guess nobody can really complain if we rip out all the
> SHM_HUGE_ stuff.

yeah, let's just get rid of it.
-- 
Michal Hocko
SUSE Labs

--
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] 6+ messages in thread

end of thread, other threads:[~2017-02-22 16:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1486673582-6979-1-git-send-email-dave@stgolabs.net>
2017-02-09 20:53 ` [PATCH 4/4] mm,hugetlb: compute page_size_log properly Davidlohr Bueso
2017-02-10 10:20   ` Michal Hocko
2017-02-10 16:51     ` Davidlohr Bueso
2017-02-20 16:11       ` Michal Hocko
2017-02-22 16:03         ` Davidlohr Bueso
2017-02-22 16:11           ` Michal Hocko

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).