* [PATCH v2 1/2] alloc_tag: export mem_alloc_profiling_key used by modules
@ 2024-07-17 18:12 Suren Baghdasaryan
2024-07-17 18:12 ` [PATCH v2 2/2] alloc_tag: outline and export free_reserved_page() Suren Baghdasaryan
0 siblings, 1 reply; 7+ messages in thread
From: Suren Baghdasaryan @ 2024-07-17 18:12 UTC (permalink / raw)
To: akpm
Cc: kent.overstreet, hch, vbabka, pasha.tatashin, souravpanda,
keescook, linux-kernel, linux-mm, surenb, kernel test robot
Export mem_alloc_profiling_key as it is used by modules (indirectly via
mem_alloc_profiling_enabled()).
Fixes: 22d407b164ff ("lib: add allocation tagging support for memory allocation profiling")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202407080044.DWMC9N9I-lkp@intel.com/
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
---
Changes since v1 [1]
- Added Acked-by, per Vlastimil Babka
[1] https://lore.kernel.org/all/20240717011631.2150066-1-surenb@google.com/
lib/alloc_tag.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c
index 81e5f9a70f22..832f79a32b3e 100644
--- a/lib/alloc_tag.c
+++ b/lib/alloc_tag.c
@@ -15,6 +15,7 @@ EXPORT_SYMBOL(_shared_alloc_tag);
DEFINE_STATIC_KEY_MAYBE(CONFIG_MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT,
mem_alloc_profiling_key);
+EXPORT_SYMBOL(mem_alloc_profiling_key);
struct allocinfo_private {
struct codetag_iterator iter;
base-commit: 51835949dda3783d4639cfa74ce13a3c9829de00
--
2.45.2.993.g49e7a77208-goog
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] alloc_tag: outline and export free_reserved_page()
2024-07-17 18:12 [PATCH v2 1/2] alloc_tag: export mem_alloc_profiling_key used by modules Suren Baghdasaryan
@ 2024-07-17 18:12 ` Suren Baghdasaryan
2024-07-17 19:35 ` Vlastimil Babka
0 siblings, 1 reply; 7+ messages in thread
From: Suren Baghdasaryan @ 2024-07-17 18:12 UTC (permalink / raw)
To: akpm
Cc: kent.overstreet, hch, vbabka, pasha.tatashin, souravpanda,
keescook, linux-kernel, linux-mm, surenb, kernel test robot
Outline and export free_reserved_page() because modules use it and it
in turn uses page_ext_{get|put} which should not be exported. The same
result could be obtained by outlining {get|put}_page_tag_ref() but that
would have higher performance impact as these functions are used in
more performance critical paths.
Fixes: dcfe378c81f7 ("lib: introduce support for page allocation tagging")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202407080044.DWMC9N9I-lkp@intel.com/
Suggested-by: Christoph Hellwig <hch@infradead.org>
Suggested-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
---
Changes since v1 [1]
- Outlined and exported free_reserved_page() in place of {get|put}_page_tag_ref,
per Vlastimil Babka
[1] https://lore.kernel.org/all/20240717011631.2150066-2-surenb@google.com/
include/linux/mm.h | 16 +---------------
mm/page_alloc.c | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index eb7c96d24ac0..b58bad248eef 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -3177,21 +3177,7 @@ extern void reserve_bootmem_region(phys_addr_t start,
phys_addr_t end, int nid);
/* Free the reserved page into the buddy system, so it gets managed. */
-static inline void free_reserved_page(struct page *page)
-{
- if (mem_alloc_profiling_enabled()) {
- union codetag_ref *ref = get_page_tag_ref(page);
-
- if (ref) {
- set_codetag_empty(ref);
- put_page_tag_ref(ref);
- }
- }
- ClearPageReserved(page);
- init_page_count(page);
- __free_page(page);
- adjust_managed_page_count(page, 1);
-}
+void free_reserved_page(struct page *page);
#define free_highmem_page(page) free_reserved_page(page)
static inline void mark_page_reserved(struct page *page)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 9ecf99190ea2..7d2fa9f5e750 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5805,6 +5805,23 @@ unsigned long free_reserved_area(void *start, void *end, int poison, const char
return pages;
}
+void free_reserved_page(struct page *page)
+{
+ if (mem_alloc_profiling_enabled()) {
+ union codetag_ref *ref = get_page_tag_ref(page);
+
+ if (ref) {
+ set_codetag_empty(ref);
+ put_page_tag_ref(ref);
+ }
+ }
+ ClearPageReserved(page);
+ init_page_count(page);
+ __free_page(page);
+ adjust_managed_page_count(page, 1);
+}
+EXPORT_SYMBOL(free_reserved_page);
+
static int page_alloc_cpu_dead(unsigned int cpu)
{
struct zone *zone;
--
2.45.2.993.g49e7a77208-goog
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] alloc_tag: outline and export free_reserved_page()
2024-07-17 18:12 ` [PATCH v2 2/2] alloc_tag: outline and export free_reserved_page() Suren Baghdasaryan
@ 2024-07-17 19:35 ` Vlastimil Babka
2024-07-17 20:04 ` Suren Baghdasaryan
0 siblings, 1 reply; 7+ messages in thread
From: Vlastimil Babka @ 2024-07-17 19:35 UTC (permalink / raw)
To: Suren Baghdasaryan, akpm
Cc: kent.overstreet, hch, pasha.tatashin, souravpanda, keescook,
linux-kernel, linux-mm, kernel test robot
On 7/17/24 8:12 PM, Suren Baghdasaryan wrote:
> Outline and export free_reserved_page() because modules use it and it
> in turn uses page_ext_{get|put} which should not be exported. The same
> result could be obtained by outlining {get|put}_page_tag_ref() but that
> would have higher performance impact as these functions are used in
> more performance critical paths.
>
> Fixes: dcfe378c81f7 ("lib: introduce support for page allocation tagging")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202407080044.DWMC9N9I-lkp@intel.com/
> Suggested-by: Christoph Hellwig <hch@infradead.org>
> Suggested-by: Vlastimil Babka <vbabka@suse.cz>
> Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Are these two patches now stable@ material as 6.10 build is broken on ppc64
with alloc taging enabled?
> ---
> Changes since v1 [1]
> - Outlined and exported free_reserved_page() in place of {get|put}_page_tag_ref,
> per Vlastimil Babka
>
> [1] https://lore.kernel.org/all/20240717011631.2150066-2-surenb@google.com/
>
> include/linux/mm.h | 16 +---------------
> mm/page_alloc.c | 17 +++++++++++++++++
> 2 files changed, 18 insertions(+), 15 deletions(-)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index eb7c96d24ac0..b58bad248eef 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -3177,21 +3177,7 @@ extern void reserve_bootmem_region(phys_addr_t start,
> phys_addr_t end, int nid);
>
> /* Free the reserved page into the buddy system, so it gets managed. */
> -static inline void free_reserved_page(struct page *page)
> -{
> - if (mem_alloc_profiling_enabled()) {
> - union codetag_ref *ref = get_page_tag_ref(page);
> -
> - if (ref) {
> - set_codetag_empty(ref);
> - put_page_tag_ref(ref);
> - }
> - }
> - ClearPageReserved(page);
> - init_page_count(page);
> - __free_page(page);
> - adjust_managed_page_count(page, 1);
> -}
> +void free_reserved_page(struct page *page);
> #define free_highmem_page(page) free_reserved_page(page)
>
> static inline void mark_page_reserved(struct page *page)
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 9ecf99190ea2..7d2fa9f5e750 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5805,6 +5805,23 @@ unsigned long free_reserved_area(void *start, void *end, int poison, const char
> return pages;
> }
>
> +void free_reserved_page(struct page *page)
> +{
> + if (mem_alloc_profiling_enabled()) {
> + union codetag_ref *ref = get_page_tag_ref(page);
> +
> + if (ref) {
> + set_codetag_empty(ref);
> + put_page_tag_ref(ref);
> + }
> + }
> + ClearPageReserved(page);
> + init_page_count(page);
> + __free_page(page);
> + adjust_managed_page_count(page, 1);
> +}
> +EXPORT_SYMBOL(free_reserved_page);
> +
> static int page_alloc_cpu_dead(unsigned int cpu)
> {
> struct zone *zone;
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] alloc_tag: outline and export free_reserved_page()
2024-07-17 19:35 ` Vlastimil Babka
@ 2024-07-17 20:04 ` Suren Baghdasaryan
2024-07-17 20:19 ` Vlastimil Babka
0 siblings, 1 reply; 7+ messages in thread
From: Suren Baghdasaryan @ 2024-07-17 20:04 UTC (permalink / raw)
To: Vlastimil Babka
Cc: akpm, kent.overstreet, hch, pasha.tatashin, souravpanda,
keescook, linux-kernel, linux-mm, kernel test robot
On Wed, Jul 17, 2024 at 12:36 PM Vlastimil Babka <vbabka@suse.cz> wrote:
>
> On 7/17/24 8:12 PM, Suren Baghdasaryan wrote:
> > Outline and export free_reserved_page() because modules use it and it
> > in turn uses page_ext_{get|put} which should not be exported. The same
> > result could be obtained by outlining {get|put}_page_tag_ref() but that
> > would have higher performance impact as these functions are used in
> > more performance critical paths.
> >
> > Fixes: dcfe378c81f7 ("lib: introduce support for page allocation tagging")
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202407080044.DWMC9N9I-lkp@intel.com/
> > Suggested-by: Christoph Hellwig <hch@infradead.org>
> > Suggested-by: Vlastimil Babka <vbabka@suse.cz>
> > Signed-off-by: Suren Baghdasaryan <surenb@google.com>
>
> Acked-by: Vlastimil Babka <vbabka@suse.cz>
>
> Are these two patches now stable@ material as 6.10 build is broken on ppc64
> with alloc taging enabled?
I tested them with that specific configuration mentioned in the bug
report and with several usual ones I use.
Yeah, I guess from now on all such fixes should have
Cc: stable@vger.kernel.org # v6.10
>
> > ---
> > Changes since v1 [1]
> > - Outlined and exported free_reserved_page() in place of {get|put}_page_tag_ref,
> > per Vlastimil Babka
> >
> > [1] https://lore.kernel.org/all/20240717011631.2150066-2-surenb@google.com/
> >
> > include/linux/mm.h | 16 +---------------
> > mm/page_alloc.c | 17 +++++++++++++++++
> > 2 files changed, 18 insertions(+), 15 deletions(-)
> >
> > diff --git a/include/linux/mm.h b/include/linux/mm.h
> > index eb7c96d24ac0..b58bad248eef 100644
> > --- a/include/linux/mm.h
> > +++ b/include/linux/mm.h
> > @@ -3177,21 +3177,7 @@ extern void reserve_bootmem_region(phys_addr_t start,
> > phys_addr_t end, int nid);
> >
> > /* Free the reserved page into the buddy system, so it gets managed. */
> > -static inline void free_reserved_page(struct page *page)
> > -{
> > - if (mem_alloc_profiling_enabled()) {
> > - union codetag_ref *ref = get_page_tag_ref(page);
> > -
> > - if (ref) {
> > - set_codetag_empty(ref);
> > - put_page_tag_ref(ref);
> > - }
> > - }
> > - ClearPageReserved(page);
> > - init_page_count(page);
> > - __free_page(page);
> > - adjust_managed_page_count(page, 1);
> > -}
> > +void free_reserved_page(struct page *page);
> > #define free_highmem_page(page) free_reserved_page(page)
> >
> > static inline void mark_page_reserved(struct page *page)
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index 9ecf99190ea2..7d2fa9f5e750 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -5805,6 +5805,23 @@ unsigned long free_reserved_area(void *start, void *end, int poison, const char
> > return pages;
> > }
> >
> > +void free_reserved_page(struct page *page)
> > +{
> > + if (mem_alloc_profiling_enabled()) {
> > + union codetag_ref *ref = get_page_tag_ref(page);
> > +
> > + if (ref) {
> > + set_codetag_empty(ref);
> > + put_page_tag_ref(ref);
> > + }
> > + }
> > + ClearPageReserved(page);
> > + init_page_count(page);
> > + __free_page(page);
> > + adjust_managed_page_count(page, 1);
> > +}
> > +EXPORT_SYMBOL(free_reserved_page);
> > +
> > static int page_alloc_cpu_dead(unsigned int cpu)
> > {
> > struct zone *zone;
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] alloc_tag: outline and export free_reserved_page()
2024-07-17 20:04 ` Suren Baghdasaryan
@ 2024-07-17 20:19 ` Vlastimil Babka
2024-07-17 21:20 ` Suren Baghdasaryan
0 siblings, 1 reply; 7+ messages in thread
From: Vlastimil Babka @ 2024-07-17 20:19 UTC (permalink / raw)
To: Suren Baghdasaryan
Cc: akpm, kent.overstreet, hch, pasha.tatashin, souravpanda,
keescook, linux-kernel, linux-mm, kernel test robot
On 7/17/24 10:04 PM, Suren Baghdasaryan wrote:
> On Wed, Jul 17, 2024 at 12:36 PM Vlastimil Babka <vbabka@suse.cz> wrote:
>>
>> On 7/17/24 8:12 PM, Suren Baghdasaryan wrote:
>> > Outline and export free_reserved_page() because modules use it and it
>> > in turn uses page_ext_{get|put} which should not be exported. The same
>> > result could be obtained by outlining {get|put}_page_tag_ref() but that
>> > would have higher performance impact as these functions are used in
>> > more performance critical paths.
>> >
>> > Fixes: dcfe378c81f7 ("lib: introduce support for page allocation tagging")
>> > Reported-by: kernel test robot <lkp@intel.com>
>> > Closes: https://lore.kernel.org/oe-kbuild-all/202407080044.DWMC9N9I-lkp@intel.com/
>> > Suggested-by: Christoph Hellwig <hch@infradead.org>
>> > Suggested-by: Vlastimil Babka <vbabka@suse.cz>
>> > Signed-off-by: Suren Baghdasaryan <surenb@google.com>
>>
>> Acked-by: Vlastimil Babka <vbabka@suse.cz>
>>
>> Are these two patches now stable@ material as 6.10 build is broken on ppc64
>> with alloc taging enabled?
>
> I tested them with that specific configuration mentioned in the bug
> report and with several usual ones I use.
> Yeah, I guess from now on all such fixes should have
>
> Cc: stable@vger.kernel.org # v6.10
Right. BTW I have just realized that the way you did Patch 2/2 and outlined
the whole free_reserved_page() (which is fair, it's an init-time function),
mem_alloc_profiling_enabled() didn't stay inlined so Patch 1/2 is in fact
not necessary anymore?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] alloc_tag: outline and export free_reserved_page()
2024-07-17 20:19 ` Vlastimil Babka
@ 2024-07-17 21:20 ` Suren Baghdasaryan
2024-07-17 21:30 ` Suren Baghdasaryan
0 siblings, 1 reply; 7+ messages in thread
From: Suren Baghdasaryan @ 2024-07-17 21:20 UTC (permalink / raw)
To: Vlastimil Babka
Cc: akpm, kent.overstreet, hch, pasha.tatashin, souravpanda,
keescook, linux-kernel, linux-mm, kernel test robot
On Wed, Jul 17, 2024 at 1:19 PM Vlastimil Babka <vbabka@suse.cz> wrote:
>
> On 7/17/24 10:04 PM, Suren Baghdasaryan wrote:
> > On Wed, Jul 17, 2024 at 12:36 PM Vlastimil Babka <vbabka@suse.cz> wrote:
> >>
> >> On 7/17/24 8:12 PM, Suren Baghdasaryan wrote:
> >> > Outline and export free_reserved_page() because modules use it and it
> >> > in turn uses page_ext_{get|put} which should not be exported. The same
> >> > result could be obtained by outlining {get|put}_page_tag_ref() but that
> >> > would have higher performance impact as these functions are used in
> >> > more performance critical paths.
> >> >
> >> > Fixes: dcfe378c81f7 ("lib: introduce support for page allocation tagging")
> >> > Reported-by: kernel test robot <lkp@intel.com>
> >> > Closes: https://lore.kernel.org/oe-kbuild-all/202407080044.DWMC9N9I-lkp@intel.com/
> >> > Suggested-by: Christoph Hellwig <hch@infradead.org>
> >> > Suggested-by: Vlastimil Babka <vbabka@suse.cz>
> >> > Signed-off-by: Suren Baghdasaryan <surenb@google.com>
> >>
> >> Acked-by: Vlastimil Babka <vbabka@suse.cz>
> >>
> >> Are these two patches now stable@ material as 6.10 build is broken on ppc64
> >> with alloc taging enabled?
> >
> > I tested them with that specific configuration mentioned in the bug
> > report and with several usual ones I use.
> > Yeah, I guess from now on all such fixes should have
> >
> > Cc: stable@vger.kernel.org # v6.10
>
> Right. BTW I have just realized that the way you did Patch 2/2 and outlined
> the whole free_reserved_page() (which is fair, it's an init-time function),
> mem_alloc_profiling_enabled() didn't stay inlined so Patch 1/2 is in fact
> not necessary anymore?
Yeah, I think you are right, currently no module has reasons to use
mem_alloc_profiling_enabled() directly. That might change in the
future but we can add the export at the time it's needed.
I checked and ppc64 build passes with just this patch. Let me post v3
with just this patch and Cc stable@.
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] alloc_tag: outline and export free_reserved_page()
2024-07-17 21:20 ` Suren Baghdasaryan
@ 2024-07-17 21:30 ` Suren Baghdasaryan
0 siblings, 0 replies; 7+ messages in thread
From: Suren Baghdasaryan @ 2024-07-17 21:30 UTC (permalink / raw)
To: Vlastimil Babka
Cc: akpm, kent.overstreet, hch, pasha.tatashin, souravpanda,
keescook, linux-kernel, linux-mm, kernel test robot
On Wed, Jul 17, 2024 at 2:20 PM Suren Baghdasaryan <surenb@google.com> wrote:
>
> On Wed, Jul 17, 2024 at 1:19 PM Vlastimil Babka <vbabka@suse.cz> wrote:
> >
> > On 7/17/24 10:04 PM, Suren Baghdasaryan wrote:
> > > On Wed, Jul 17, 2024 at 12:36 PM Vlastimil Babka <vbabka@suse.cz> wrote:
> > >>
> > >> On 7/17/24 8:12 PM, Suren Baghdasaryan wrote:
> > >> > Outline and export free_reserved_page() because modules use it and it
> > >> > in turn uses page_ext_{get|put} which should not be exported. The same
> > >> > result could be obtained by outlining {get|put}_page_tag_ref() but that
> > >> > would have higher performance impact as these functions are used in
> > >> > more performance critical paths.
> > >> >
> > >> > Fixes: dcfe378c81f7 ("lib: introduce support for page allocation tagging")
> > >> > Reported-by: kernel test robot <lkp@intel.com>
> > >> > Closes: https://lore.kernel.org/oe-kbuild-all/202407080044.DWMC9N9I-lkp@intel.com/
> > >> > Suggested-by: Christoph Hellwig <hch@infradead.org>
> > >> > Suggested-by: Vlastimil Babka <vbabka@suse.cz>
> > >> > Signed-off-by: Suren Baghdasaryan <surenb@google.com>
> > >>
> > >> Acked-by: Vlastimil Babka <vbabka@suse.cz>
> > >>
> > >> Are these two patches now stable@ material as 6.10 build is broken on ppc64
> > >> with alloc taging enabled?
> > >
> > > I tested them with that specific configuration mentioned in the bug
> > > report and with several usual ones I use.
> > > Yeah, I guess from now on all such fixes should have
> > >
> > > Cc: stable@vger.kernel.org # v6.10
> >
> > Right. BTW I have just realized that the way you did Patch 2/2 and outlined
> > the whole free_reserved_page() (which is fair, it's an init-time function),
> > mem_alloc_profiling_enabled() didn't stay inlined so Patch 1/2 is in fact
> > not necessary anymore?
>
> Yeah, I think you are right, currently no module has reasons to use
> mem_alloc_profiling_enabled() directly. That might change in the
> future but we can add the export at the time it's needed.
> I checked and ppc64 build passes with just this patch. Let me post v3
> with just this patch and Cc stable@.
v3 posted at https://lore.kernel.org/all/20240717212844.2749975-1-surenb@google.com/
>
>
> >
> >
> >
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-07-17 21:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-17 18:12 [PATCH v2 1/2] alloc_tag: export mem_alloc_profiling_key used by modules Suren Baghdasaryan
2024-07-17 18:12 ` [PATCH v2 2/2] alloc_tag: outline and export free_reserved_page() Suren Baghdasaryan
2024-07-17 19:35 ` Vlastimil Babka
2024-07-17 20:04 ` Suren Baghdasaryan
2024-07-17 20:19 ` Vlastimil Babka
2024-07-17 21:20 ` Suren Baghdasaryan
2024-07-17 21:30 ` Suren Baghdasaryan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox