From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
vitaly.wool@konsulko.com, cerasuolodomenico@gmail.com,
nphamcs@gmail.com, hch@infradead.org, yosryahmed@google.com,
akpm@linux-foundation.org
Subject: [PATCH 3/5] memcg: Convert get_obj_cgroup_from_page to get_obj_cgroup_from_folio
Date: Sat, 15 Jul 2023 05:23:41 +0100 [thread overview]
Message-ID: <20230715042343.434588-4-willy@infradead.org> (raw)
In-Reply-To: <20230715042343.434588-1-willy@infradead.org>
As the one caller now has a folio, pass it in and use it. Removes three
calls to compound_head().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/memcontrol.h | 4 ++--
mm/memcontrol.c | 8 ++++----
mm/zswap.c | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 5818af8eca5a..7b676752f474 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -1761,7 +1761,7 @@ int __memcg_kmem_charge_page(struct page *page, gfp_t gfp, int order);
void __memcg_kmem_uncharge_page(struct page *page, int order);
struct obj_cgroup *get_obj_cgroup_from_current(void);
-struct obj_cgroup *get_obj_cgroup_from_page(struct page *page);
+struct obj_cgroup *get_obj_cgroup_from_folio(struct folio *folio);
int obj_cgroup_charge(struct obj_cgroup *objcg, gfp_t gfp, size_t size);
void obj_cgroup_uncharge(struct obj_cgroup *objcg, size_t size);
@@ -1845,7 +1845,7 @@ static inline void __memcg_kmem_uncharge_page(struct page *page, int order)
{
}
-static inline struct obj_cgroup *get_obj_cgroup_from_page(struct page *page)
+static inline struct obj_cgroup *get_obj_cgroup_from_folio(struct folio *folio)
{
return NULL;
}
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e8ca4bdcb03c..acc9acb0c9a1 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3036,21 +3036,21 @@ __always_inline struct obj_cgroup *get_obj_cgroup_from_current(void)
return objcg;
}
-struct obj_cgroup *get_obj_cgroup_from_page(struct page *page)
+struct obj_cgroup *get_obj_cgroup_from_folio(struct folio *folio)
{
struct obj_cgroup *objcg;
if (!memcg_kmem_online())
return NULL;
- if (PageMemcgKmem(page)) {
- objcg = __folio_objcg(page_folio(page));
+ if (folio_memcg_kmem(folio)) {
+ objcg = __folio_objcg(folio);
obj_cgroup_get(objcg);
} else {
struct mem_cgroup *memcg;
rcu_read_lock();
- memcg = __folio_memcg(page_folio(page));
+ memcg = __folio_memcg(folio);
if (memcg)
objcg = __get_obj_cgroup_from_memcg(memcg);
else
diff --git a/mm/zswap.c b/mm/zswap.c
index ba50b186ee27..69d097d14255 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -1235,7 +1235,7 @@ bool zswap_store(struct folio *folio)
* cgroup-aware entry LRU, we will push out entries system-wide based on
* local cgroup limits.
*/
- objcg = get_obj_cgroup_from_page(page);
+ objcg = get_obj_cgroup_from_folio(folio);
if (objcg && !obj_cgroup_may_zswap(objcg))
goto reject;
--
2.39.2
next prev parent reply other threads:[~2023-07-15 4:24 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-14 19:46 [PATCH] mm: kill frontswap Johannes Weiner
2023-07-14 21:10 ` Konrad Rzeszutek Wilk
2023-07-14 22:25 ` Nhat Pham
2023-07-15 3:42 ` Matthew Wilcox
2023-07-17 14:12 ` Johannes Weiner
2023-07-17 14:31 ` Vlastimil Babka
2023-07-17 16:02 ` Johannes Weiner
2023-07-17 16:07 ` Matthew Wilcox
2023-07-17 21:51 ` Johannes Weiner
2023-07-17 22:58 ` Nhat Pham
2023-07-18 18:52 ` Yosry Ahmed
2023-07-19 14:28 ` Johannes Weiner
2023-07-19 15:22 ` Yosry Ahmed
2024-01-16 20:09 ` Andrew Morton
2024-01-16 20:18 ` Matthew Wilcox
2024-01-16 20:22 ` Yosry Ahmed
2024-01-16 21:35 ` Andrew Morton
2023-07-15 4:23 ` [PATCH 0/5] Followup folio conversions for zswap Matthew Wilcox (Oracle)
2023-07-15 4:23 ` [PATCH 1/5] fix-frontswap Matthew Wilcox (Oracle)
2023-07-15 4:23 ` [PATCH 2/5] zswap: Make zswap_store() take a folio Matthew Wilcox (Oracle)
2023-07-15 4:23 ` Matthew Wilcox (Oracle) [this message]
2023-07-15 4:23 ` [PATCH 4/5] swap: Remove some calls to compound_head() in swap_readpage() Matthew Wilcox (Oracle)
2023-07-15 4:23 ` [PATCH 5/5] zswap: Make zswap_load() take a folio Matthew Wilcox (Oracle)
2023-07-20 6:00 ` [PATCH] mm: kill frontswap Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230715042343.434588-4-willy@infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=cerasuolodomenico@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=vitaly.wool@konsulko.com \
--cc=yosryahmed@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox