* [PATCH 1/3] lib: add missing newline character in the warning message
@ 2024-07-11 22:04 Suren Baghdasaryan
2024-07-11 22:04 ` [PATCH 2/3] lib: reuse page_ext_data() to obtain codetag_ref Suren Baghdasaryan
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Suren Baghdasaryan @ 2024-07-11 22:04 UTC (permalink / raw)
To: akpm
Cc: kent.overstreet, vbabka, pasha.tatashin, souravpanda, keescook,
linux-mm, linux-kernel, surenb
Fixes: 22d407b164ff ("lib: add allocation tagging support for memory allocation profiling")
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
---
include/linux/alloc_tag.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/alloc_tag.h b/include/linux/alloc_tag.h
index abd24016a900..8c61ccd161ba 100644
--- a/include/linux/alloc_tag.h
+++ b/include/linux/alloc_tag.h
@@ -122,7 +122,7 @@ static inline void alloc_tag_add_check(union codetag_ref *ref, struct alloc_tag
"alloc_tag was not cleared (got tag for %s:%u)\n",
ref->ct->filename, ref->ct->lineno);
- WARN_ONCE(!tag, "current->alloc_tag not set");
+ WARN_ONCE(!tag, "current->alloc_tag not set\n");
}
static inline void alloc_tag_sub_check(union codetag_ref *ref)
base-commit: 8a18fda0febb7790de20ec1c3b4522ce026be1c6
--
2.45.2.993.g49e7a77208-goog
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/3] lib: reuse page_ext_data() to obtain codetag_ref
2024-07-11 22:04 [PATCH 1/3] lib: add missing newline character in the warning message Suren Baghdasaryan
@ 2024-07-11 22:04 ` Suren Baghdasaryan
2024-07-11 22:04 ` [PATCH 3/3] alloc_tag: fix page_ext_get/page_ext_put sequence during page splitting Suren Baghdasaryan
2024-07-11 22:06 ` [PATCH 1/3] lib: add missing newline character in the warning message Suren Baghdasaryan
2 siblings, 0 replies; 4+ messages in thread
From: Suren Baghdasaryan @ 2024-07-11 22:04 UTC (permalink / raw)
To: akpm
Cc: kent.overstreet, vbabka, pasha.tatashin, souravpanda, keescook,
linux-mm, linux-kernel, surenb
codetag_ref_from_page_ext() reimplements the same calculation as
page_ext_data(). Reuse existing function instead.
Fixes: dcfe378c81f7 ("lib: introduce support for page allocation tagging")
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
---
include/linux/pgalloc_tag.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/pgalloc_tag.h b/include/linux/pgalloc_tag.h
index 9cacadbd61f8..acb1e9ce7981 100644
--- a/include/linux/pgalloc_tag.h
+++ b/include/linux/pgalloc_tag.h
@@ -15,7 +15,7 @@ extern struct page_ext_operations page_alloc_tagging_ops;
static inline union codetag_ref *codetag_ref_from_page_ext(struct page_ext *page_ext)
{
- return (void *)page_ext + page_alloc_tagging_ops.offset;
+ return (union codetag_ref *)page_ext_data(page_ext, &page_alloc_tagging_ops);
}
static inline struct page_ext *page_ext_from_codetag_ref(union codetag_ref *ref)
--
2.45.2.993.g49e7a77208-goog
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/3] alloc_tag: fix page_ext_get/page_ext_put sequence during page splitting
2024-07-11 22:04 [PATCH 1/3] lib: add missing newline character in the warning message Suren Baghdasaryan
2024-07-11 22:04 ` [PATCH 2/3] lib: reuse page_ext_data() to obtain codetag_ref Suren Baghdasaryan
@ 2024-07-11 22:04 ` Suren Baghdasaryan
2024-07-11 22:06 ` [PATCH 1/3] lib: add missing newline character in the warning message Suren Baghdasaryan
2 siblings, 0 replies; 4+ messages in thread
From: Suren Baghdasaryan @ 2024-07-11 22:04 UTC (permalink / raw)
To: akpm
Cc: kent.overstreet, vbabka, pasha.tatashin, souravpanda, keescook,
linux-mm, linux-kernel, surenb
pgalloc_tag_sub() might call page_ext_put() using a page different from
the one used in page_ext_get() call. This does not pose an issue since
page_ext_put() ignores this parameter as long as it's non-NULL but
technically this is wrong. Fix it by storing the original page used in
page_ext_get() and passing it to page_ext_put().
Fixes: be25d1d4e822 ("mm: create new codetag references during page splitting")
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
---
include/linux/pgalloc_tag.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/linux/pgalloc_tag.h b/include/linux/pgalloc_tag.h
index acb1e9ce7981..18cd0c0c73d9 100644
--- a/include/linux/pgalloc_tag.h
+++ b/include/linux/pgalloc_tag.h
@@ -71,6 +71,7 @@ static inline void pgalloc_tag_sub(struct page *page, unsigned int nr)
static inline void pgalloc_tag_split(struct page *page, unsigned int nr)
{
int i;
+ struct page_ext *first_page_ext;
struct page_ext *page_ext;
union codetag_ref *ref;
struct alloc_tag *tag;
@@ -78,7 +79,7 @@ static inline void pgalloc_tag_split(struct page *page, unsigned int nr)
if (!mem_alloc_profiling_enabled())
return;
- page_ext = page_ext_get(page);
+ first_page_ext = page_ext = page_ext_get(page);
if (unlikely(!page_ext))
return;
@@ -94,7 +95,7 @@ static inline void pgalloc_tag_split(struct page *page, unsigned int nr)
page_ext = page_ext_next(page_ext);
}
out:
- page_ext_put(page_ext);
+ page_ext_put(first_page_ext);
}
static inline struct alloc_tag *pgalloc_tag_get(struct page *page)
--
2.45.2.993.g49e7a77208-goog
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] lib: add missing newline character in the warning message
2024-07-11 22:04 [PATCH 1/3] lib: add missing newline character in the warning message Suren Baghdasaryan
2024-07-11 22:04 ` [PATCH 2/3] lib: reuse page_ext_data() to obtain codetag_ref Suren Baghdasaryan
2024-07-11 22:04 ` [PATCH 3/3] alloc_tag: fix page_ext_get/page_ext_put sequence during page splitting Suren Baghdasaryan
@ 2024-07-11 22:06 ` Suren Baghdasaryan
2 siblings, 0 replies; 4+ messages in thread
From: Suren Baghdasaryan @ 2024-07-11 22:06 UTC (permalink / raw)
To: akpm
Cc: kent.overstreet, vbabka, pasha.tatashin, souravpanda, keescook,
linux-mm, linux-kernel
On Thu, Jul 11, 2024 at 3:05 PM Suren Baghdasaryan <surenb@google.com> wrote:
>
> Fixes: 22d407b164ff ("lib: add allocation tagging support for memory allocation profiling")
> Signed-off-by: Suren Baghdasaryan <surenb@google.com>
The fixes in this patchset are cleanups, not critical and not urgent.
Thanks,
Suren.
> ---
> include/linux/alloc_tag.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/alloc_tag.h b/include/linux/alloc_tag.h
> index abd24016a900..8c61ccd161ba 100644
> --- a/include/linux/alloc_tag.h
> +++ b/include/linux/alloc_tag.h
> @@ -122,7 +122,7 @@ static inline void alloc_tag_add_check(union codetag_ref *ref, struct alloc_tag
> "alloc_tag was not cleared (got tag for %s:%u)\n",
> ref->ct->filename, ref->ct->lineno);
>
> - WARN_ONCE(!tag, "current->alloc_tag not set");
> + WARN_ONCE(!tag, "current->alloc_tag not set\n");
> }
>
> static inline void alloc_tag_sub_check(union codetag_ref *ref)
>
> base-commit: 8a18fda0febb7790de20ec1c3b4522ce026be1c6
> --
> 2.45.2.993.g49e7a77208-goog
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-07-11 22:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-11 22:04 [PATCH 1/3] lib: add missing newline character in the warning message Suren Baghdasaryan
2024-07-11 22:04 ` [PATCH 2/3] lib: reuse page_ext_data() to obtain codetag_ref Suren Baghdasaryan
2024-07-11 22:04 ` [PATCH 3/3] alloc_tag: fix page_ext_get/page_ext_put sequence during page splitting Suren Baghdasaryan
2024-07-11 22:06 ` [PATCH 1/3] lib: add missing newline character in the warning message Suren Baghdasaryan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox