* [PATCH] nommu: remove __GFP_HIGHMEM in vmalloc/vzalloc
@ 2021-05-03 12:44 Chen Li
2021-05-03 13:05 ` Matthew Wilcox
2021-05-05 11:14 ` David Hildenbrand
0 siblings, 2 replies; 3+ messages in thread
From: Chen Li @ 2021-05-03 12:44 UTC (permalink / raw)
To: Andrew Morton, linux-mm, linux-kernel
From mm/nommu.c:
void *__vmalloc(unsigned long size, gfp_t gfp_mask)
{
/*
* You can't specify __GFP_HIGHMEM with kmalloc() since kmalloc()
* returns only a logical address.
*/
return kmalloc(size, (gfp_mask | __GFP_COMP) & ~__GFP_HIGHMEM);
}
nommu's __vmalloc just uses kmalloc internally and elimitates __GFP_HIGHMEM,
so it makes no sense to add __GFP_HIGHMEM for nommu's vmalloc/vzalloc.
Signed-off-by: Chen Li <chenli@uniontech.com>
---
mm/nommu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/nommu.c b/mm/nommu.c
index 5c9ab799c0e6..339a2f2eb1aa 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -233,7 +233,7 @@ long vwrite(char *buf, char *addr, unsigned long count)
*/
void *vmalloc(unsigned long size)
{
- return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM);
+ return __vmalloc(size, GFP_KERNEL);
}
EXPORT_SYMBOL(vmalloc);
@@ -251,7 +251,7 @@ EXPORT_SYMBOL(vmalloc);
*/
void *vzalloc(unsigned long size)
{
- return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO);
+ return __vmalloc(size, GFP_KERNEL | __GFP_ZERO);
}
EXPORT_SYMBOL(vzalloc);
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nommu: remove __GFP_HIGHMEM in vmalloc/vzalloc
2021-05-03 12:44 [PATCH] nommu: remove __GFP_HIGHMEM in vmalloc/vzalloc Chen Li
@ 2021-05-03 13:05 ` Matthew Wilcox
2021-05-05 11:14 ` David Hildenbrand
1 sibling, 0 replies; 3+ messages in thread
From: Matthew Wilcox @ 2021-05-03 13:05 UTC (permalink / raw)
To: Chen Li; +Cc: Andrew Morton, linux-mm, linux-kernel
On Mon, May 03, 2021 at 08:44:51PM +0800, Chen Li wrote:
>
> From mm/nommu.c:
> void *__vmalloc(unsigned long size, gfp_t gfp_mask)
> {
> /*
> * You can't specify __GFP_HIGHMEM with kmalloc() since kmalloc()
> * returns only a logical address.
> */
> return kmalloc(size, (gfp_mask | __GFP_COMP) & ~__GFP_HIGHMEM);
> }
>
> nommu's __vmalloc just uses kmalloc internally and elimitates __GFP_HIGHMEM,
> so it makes no sense to add __GFP_HIGHMEM for nommu's vmalloc/vzalloc.
I think this was originally [1] a copy of vmalloc() from vmalloc.c,
but of course the two have drifted apart over time. At the time,
vmalloc.c's vmalloc() looked like this:
+void * vmalloc (unsigned long size)
+{
+ return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL);
+}
[1] And I do mean originally; this was present in Alan Cox's original
submission of mm/nommu.c in 2002.
This patch makes sense to me, although I don't imagine it makes
much difference.
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Signed-off-by: Chen Li <chenli@uniontech.com>
> ---
> mm/nommu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/nommu.c b/mm/nommu.c
> index 5c9ab799c0e6..339a2f2eb1aa 100644
> --- a/mm/nommu.c
> +++ b/mm/nommu.c
> @@ -233,7 +233,7 @@ long vwrite(char *buf, char *addr, unsigned long count)
> */
> void *vmalloc(unsigned long size)
> {
> - return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM);
> + return __vmalloc(size, GFP_KERNEL);
> }
> EXPORT_SYMBOL(vmalloc);
>
> @@ -251,7 +251,7 @@ EXPORT_SYMBOL(vmalloc);
> */
> void *vzalloc(unsigned long size)
> {
> - return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO);
> + return __vmalloc(size, GFP_KERNEL | __GFP_ZERO);
> }
> EXPORT_SYMBOL(vzalloc);
>
> --
> 2.31.1
>
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nommu: remove __GFP_HIGHMEM in vmalloc/vzalloc
2021-05-03 12:44 [PATCH] nommu: remove __GFP_HIGHMEM in vmalloc/vzalloc Chen Li
2021-05-03 13:05 ` Matthew Wilcox
@ 2021-05-05 11:14 ` David Hildenbrand
1 sibling, 0 replies; 3+ messages in thread
From: David Hildenbrand @ 2021-05-05 11:14 UTC (permalink / raw)
To: Chen Li, Andrew Morton, linux-mm, linux-kernel
On 03.05.21 14:44, Chen Li wrote:
>
> From mm/nommu.c:
> void *__vmalloc(unsigned long size, gfp_t gfp_mask)
> {
> /*
> * You can't specify __GFP_HIGHMEM with kmalloc() since kmalloc()
> * returns only a logical address.
> */
> return kmalloc(size, (gfp_mask | __GFP_COMP) & ~__GFP_HIGHMEM);
> }
>
> nommu's __vmalloc just uses kmalloc internally and elimitates __GFP_HIGHMEM,
> so it makes no sense to add __GFP_HIGHMEM for nommu's vmalloc/vzalloc.
>
> Signed-off-by: Chen Li <chenli@uniontech.com>
> ---
> mm/nommu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/nommu.c b/mm/nommu.c
> index 5c9ab799c0e6..339a2f2eb1aa 100644
> --- a/mm/nommu.c
> +++ b/mm/nommu.c
> @@ -233,7 +233,7 @@ long vwrite(char *buf, char *addr, unsigned long count)
> */
> void *vmalloc(unsigned long size)
> {
> - return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM);
> + return __vmalloc(size, GFP_KERNEL);
> }
> EXPORT_SYMBOL(vmalloc);
>
> @@ -251,7 +251,7 @@ EXPORT_SYMBOL(vmalloc);
> */
> void *vzalloc(unsigned long size)
> {
> - return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO);
> + return __vmalloc(size, GFP_KERNEL | __GFP_ZERO);
> }
> EXPORT_SYMBOL(vzalloc);
>
>
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-05 11:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-03 12:44 [PATCH] nommu: remove __GFP_HIGHMEM in vmalloc/vzalloc Chen Li
2021-05-03 13:05 ` Matthew Wilcox
2021-05-05 11:14 ` David Hildenbrand
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).