linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] arch/um: fix forward declaration for vmalloc
@ 2024-03-26  7:37 Suren Baghdasaryan
  2024-03-26 15:37 ` SeongJae Park
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Suren Baghdasaryan @ 2024-03-26  7:37 UTC (permalink / raw)
  To: akpm
  Cc: sfr, kent.overstreet, sj, richard, anton.ivanov, johannes,
	surenb, linux-mm, linux-um, linux-next, linux-kernel

Patch [1] replaced vmalloc() function with a new definition but it did
not adjust the forward declaration used in UML architecture. Change it
to act as before.
Note that this prevents the vmalloc() allocations in __wrap_malloc()
from being accounted. If accounting here is critical, we will have
to remove this forward declaration and include vmalloc.h, however
that would pull in more dependencies and would require introducing more
architecture-specific headers, like asm/bug.h, asm/rwonce.h, etc.
This is likely the reason why this forward declaration was introduced
in the first place.

[1] https://lore.kernel.org/all/20240321163705.3067592-31-surenb@google.com/

Fixes: 576477564ede ("mm: vmalloc: enable memory allocation profiling")
Reported-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
---
 arch/um/include/shared/um_malloc.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/um/include/shared/um_malloc.h b/arch/um/include/shared/um_malloc.h
index 13da93284c2c..bf503658f08e 100644
--- a/arch/um/include/shared/um_malloc.h
+++ b/arch/um/include/shared/um_malloc.h
@@ -11,7 +11,8 @@
 extern void *uml_kmalloc(int size, int flags);
 extern void kfree(const void *ptr);
 
-extern void *vmalloc(unsigned long size);
+extern void *vmalloc_noprof(unsigned long size);
+#define vmalloc(...)		vmalloc_noprof(__VA_ARGS__)
 extern void vfree(void *ptr);
 
 #endif /* __UM_MALLOC_H__ */
-- 
2.44.0.396.g6e790dbe36-goog


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

* Re: [PATCH 1/1] arch/um: fix forward declaration for vmalloc
  2024-03-26  7:37 [PATCH 1/1] arch/um: fix forward declaration for vmalloc Suren Baghdasaryan
@ 2024-03-26 15:37 ` SeongJae Park
  2024-03-28  8:48 ` Johannes Berg
  2024-04-22 20:11 ` Richard Weinberger
  2 siblings, 0 replies; 8+ messages in thread
From: SeongJae Park @ 2024-03-26 15:37 UTC (permalink / raw)
  To: Suren Baghdasaryan
  Cc: SeongJae Park, akpm, sfr, kent.overstreet, richard, anton.ivanov,
	johannes, linux-mm, linux-um, linux-next, linux-kernel

On Tue, 26 Mar 2024 00:37:50 -0700 Suren Baghdasaryan <surenb@google.com> wrote:

> Patch [1] replaced vmalloc() function with a new definition but it did
> not adjust the forward declaration used in UML architecture. Change it
> to act as before.
> Note that this prevents the vmalloc() allocations in __wrap_malloc()
> from being accounted. If accounting here is critical, we will have
> to remove this forward declaration and include vmalloc.h, however
> that would pull in more dependencies and would require introducing more
> architecture-specific headers, like asm/bug.h, asm/rwonce.h, etc.
> This is likely the reason why this forward declaration was introduced
> in the first place.
> 
> [1] https://lore.kernel.org/all/20240321163705.3067592-31-surenb@google.com/
> 
> Fixes: 576477564ede ("mm: vmalloc: enable memory allocation profiling")
> Reported-by: SeongJae Park <sj@kernel.org>
> Signed-off-by: Suren Baghdasaryan <surenb@google.com>

Thank you for this fix, Suren.  I confirmed that this patch fixes the issue I
reported.

Closes: https://lore.kernel.org/all/20240323180506.195396-1-sj@kernel.org/
Tested-by: SeongJae Park <sj@kernel.org>


Thanks,
SJ

> ---
>  arch/um/include/shared/um_malloc.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/um/include/shared/um_malloc.h b/arch/um/include/shared/um_malloc.h
> index 13da93284c2c..bf503658f08e 100644
> --- a/arch/um/include/shared/um_malloc.h
> +++ b/arch/um/include/shared/um_malloc.h
> @@ -11,7 +11,8 @@
>  extern void *uml_kmalloc(int size, int flags);
>  extern void kfree(const void *ptr);
>  
> -extern void *vmalloc(unsigned long size);
> +extern void *vmalloc_noprof(unsigned long size);
> +#define vmalloc(...)		vmalloc_noprof(__VA_ARGS__)
>  extern void vfree(void *ptr);
>  
>  #endif /* __UM_MALLOC_H__ */
> -- 
> 2.44.0.396.g6e790dbe36-goog

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

* Re: [PATCH 1/1] arch/um: fix forward declaration for vmalloc
  2024-03-26  7:37 [PATCH 1/1] arch/um: fix forward declaration for vmalloc Suren Baghdasaryan
  2024-03-26 15:37 ` SeongJae Park
@ 2024-03-28  8:48 ` Johannes Berg
  2024-04-22 20:11 ` Richard Weinberger
  2 siblings, 0 replies; 8+ messages in thread
From: Johannes Berg @ 2024-03-28  8:48 UTC (permalink / raw)
  To: Suren Baghdasaryan, akpm
  Cc: sfr, kent.overstreet, sj, richard, anton.ivanov, linux-mm,
	linux-um, linux-next, linux-kernel

On Tue, 2024-03-26 at 00:37 -0700, Suren Baghdasaryan wrote:
> 
> -extern void *vmalloc(unsigned long size);
> +extern void *vmalloc_noprof(unsigned long size);
> +#define vmalloc(...)		vmalloc_noprof(__VA_ARGS__)
> 

I was confused a bit by the define at first, but that's because this is
a user-side header file.

Reviewed-by: Johannes Berg <johannes@sipsolutions.net

johannes

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

* Re: [PATCH 1/1] arch/um: fix forward declaration for vmalloc
  2024-03-26  7:37 [PATCH 1/1] arch/um: fix forward declaration for vmalloc Suren Baghdasaryan
  2024-03-26 15:37 ` SeongJae Park
  2024-03-28  8:48 ` Johannes Berg
@ 2024-04-22 20:11 ` Richard Weinberger
  2024-04-22 20:19   ` Suren Baghdasaryan
  2 siblings, 1 reply; 8+ messages in thread
From: Richard Weinberger @ 2024-04-22 20:11 UTC (permalink / raw)
  To: Suren Baghdasaryan
  Cc: Andrew Morton, Stephen Rothwell, kent overstreet, SeongJae Park,
	anton ivanov, Johannes Berg, linux-mm, linux-um,
	Linux Next Mailing List, linux-kernel

----- Ursprüngliche Mail -----
> Von: "Suren Baghdasaryan" <surenb@google.com>
> Betreff: [PATCH 1/1] arch/um: fix forward declaration for vmalloc

> Patch [1] replaced vmalloc() function with a new definition but it did
> not adjust the forward declaration used in UML architecture. Change it
> to act as before.
> Note that this prevents the vmalloc() allocations in __wrap_malloc()
> from being accounted. If accounting here is critical, we will have
> to remove this forward declaration and include vmalloc.h, however
> that would pull in more dependencies and would require introducing more
> architecture-specific headers, like asm/bug.h, asm/rwonce.h, etc.
> This is likely the reason why this forward declaration was introduced
> in the first place.
> 
> [1] https://lore.kernel.org/all/20240321163705.3067592-31-surenb@google.com/
> 
> Fixes: 576477564ede ("mm: vmalloc: enable memory allocation profiling")

This commit id is not in Linus tree.
Do I miss something?

Thanks,
//richard

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

* Re: [PATCH 1/1] arch/um: fix forward declaration for vmalloc
  2024-04-22 20:11 ` Richard Weinberger
@ 2024-04-22 20:19   ` Suren Baghdasaryan
  2024-04-22 20:31     ` Richard Weinberger
  0 siblings, 1 reply; 8+ messages in thread
From: Suren Baghdasaryan @ 2024-04-22 20:19 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Andrew Morton, Stephen Rothwell, kent overstreet, SeongJae Park,
	anton ivanov, Johannes Berg, linux-mm, linux-um,
	Linux Next Mailing List, linux-kernel

On Mon, Apr 22, 2024 at 1:11 PM Richard Weinberger <richard@nod.at> wrote:
>
> ----- Ursprüngliche Mail -----
> > Von: "Suren Baghdasaryan" <surenb@google.com>
> > Betreff: [PATCH 1/1] arch/um: fix forward declaration for vmalloc
>
> > Patch [1] replaced vmalloc() function with a new definition but it did
> > not adjust the forward declaration used in UML architecture. Change it
> > to act as before.
> > Note that this prevents the vmalloc() allocations in __wrap_malloc()
> > from being accounted. If accounting here is critical, we will have
> > to remove this forward declaration and include vmalloc.h, however
> > that would pull in more dependencies and would require introducing more
> > architecture-specific headers, like asm/bug.h, asm/rwonce.h, etc.
> > This is likely the reason why this forward declaration was introduced
> > in the first place.
> >
> > [1] https://lore.kernel.org/all/20240321163705.3067592-31-surenb@google.com/
> >
> > Fixes: 576477564ede ("mm: vmalloc: enable memory allocation profiling")
>
> This commit id is not in Linus tree.
> Do I miss something?

It's in mm-unstable under dc26c7e79daf2fc11169b23c150862f0e878ee5a. I
think it just didn't reach Linus' tree yet.

>
> Thanks,
> //richard

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

* Re: [PATCH 1/1] arch/um: fix forward declaration for vmalloc
  2024-04-22 20:19   ` Suren Baghdasaryan
@ 2024-04-22 20:31     ` Richard Weinberger
  2024-04-22 20:39       ` Suren Baghdasaryan
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Weinberger @ 2024-04-22 20:31 UTC (permalink / raw)
  To: Suren Baghdasaryan
  Cc: Andrew Morton, Stephen Rothwell, kent overstreet, SeongJae Park,
	anton ivanov, Johannes Berg, linux-mm, linux-um,
	Linux Next Mailing List, linux-kernel

----- Ursprüngliche Mail -----
> Von: "Suren Baghdasaryan" <surenb@google.com>
>> > Fixes: 576477564ede ("mm: vmalloc: enable memory allocation profiling")
>>
>> This commit id is not in Linus tree.
>> Do I miss something?
> 
> It's in mm-unstable under dc26c7e79daf2fc11169b23c150862f0e878ee5a. I
> think it just didn't reach Linus' tree yet.

Hmm, so we better postpone this path until said commit hits Linus tree,
or you carry it together with the commit in mm-unstable.

Thanks,
//richard

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

* Re: [PATCH 1/1] arch/um: fix forward declaration for vmalloc
  2024-04-22 20:31     ` Richard Weinberger
@ 2024-04-22 20:39       ` Suren Baghdasaryan
  2024-04-22 20:50         ` Richard Weinberger
  0 siblings, 1 reply; 8+ messages in thread
From: Suren Baghdasaryan @ 2024-04-22 20:39 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Andrew Morton, Stephen Rothwell, kent overstreet, SeongJae Park,
	anton ivanov, Johannes Berg, linux-mm, linux-um,
	Linux Next Mailing List, linux-kernel

On Mon, Apr 22, 2024 at 1:31 PM Richard Weinberger <richard@nod.at> wrote:
>
> ----- Ursprüngliche Mail -----
> > Von: "Suren Baghdasaryan" <surenb@google.com>
> >> > Fixes: 576477564ede ("mm: vmalloc: enable memory allocation profiling")
> >>
> >> This commit id is not in Linus tree.
> >> Do I miss something?
> >
> > It's in mm-unstable under dc26c7e79daf2fc11169b23c150862f0e878ee5a. I
> > think it just didn't reach Linus' tree yet.
>
> Hmm, so we better postpone this path until said commit hits Linus tree,
> or you carry it together with the commit in mm-unstable.

Oh, sorry, I didn't realize you were talking about the `Fixes:
576477564ede` part... Yeah, unfortunately SHAs in mm-unstable are
unstable, so the change being fixed is under
edf0a25633bda1e5b7844478dd13b4326a3d5d09 now. I think Andrew placed
this fix right after the change it fixes with intention to merge them
together later on.

>
> Thanks,
> //richard

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

* Re: [PATCH 1/1] arch/um: fix forward declaration for vmalloc
  2024-04-22 20:39       ` Suren Baghdasaryan
@ 2024-04-22 20:50         ` Richard Weinberger
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Weinberger @ 2024-04-22 20:50 UTC (permalink / raw)
  To: Suren Baghdasaryan
  Cc: Andrew Morton, Stephen Rothwell, kent overstreet, SeongJae Park,
	anton ivanov, Johannes Berg, linux-mm, linux-um,
	Linux Next Mailing List, linux-kernel

----- Ursprüngliche Mail -----
> Von: "Suren Baghdasaryan" <surenb@google.com>
>> > It's in mm-unstable under dc26c7e79daf2fc11169b23c150862f0e878ee5a. I
>> > think it just didn't reach Linus' tree yet.
>>
>> Hmm, so we better postpone this path until said commit hits Linus tree,
>> or you carry it together with the commit in mm-unstable.
> 
> Oh, sorry, I didn't realize you were talking about the `Fixes:
> 576477564ede` part... Yeah, unfortunately SHAs in mm-unstable are
> unstable, so the change being fixed is under
> edf0a25633bda1e5b7844478dd13b4326a3d5d09 now. I think Andrew placed
> this fix right after the change it fixes with intention to merge them
> together later on.

Ah, the patch itself goes via Andrew's tree, works for me!
Let me note this in the uml patchwork system.

Acked-by: Richard Weinberger <richard@nod.at>

Thanks,
//richard

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

end of thread, other threads:[~2024-04-22 20:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-26  7:37 [PATCH 1/1] arch/um: fix forward declaration for vmalloc Suren Baghdasaryan
2024-03-26 15:37 ` SeongJae Park
2024-03-28  8:48 ` Johannes Berg
2024-04-22 20:11 ` Richard Weinberger
2024-04-22 20:19   ` Suren Baghdasaryan
2024-04-22 20:31     ` Richard Weinberger
2024-04-22 20:39       ` Suren Baghdasaryan
2024-04-22 20:50         ` Richard Weinberger

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