From: Zi Yan <zi.yan@sent.com>
To: linux-mm@kvack.org, Matthew Wilcox <willy@infradead.org>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Roman Gushchin <guro@fb.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
Yang Shi <shy828301@gmail.com>, Michal Hocko <mhocko@kernel.org>,
John Hubbard <jhubbard@nvidia.com>,
Ralph Campbell <rcampbell@nvidia.com>,
David Nellans <dnellans@nvidia.com>, Zi Yan <ziy@nvidia.com>
Subject: [PATCH 3/7] mm: memcg: make memcg huge page split support any order split.
Date: Thu, 19 Nov 2020 11:06:01 -0500 [thread overview]
Message-ID: <20201119160605.1272425-4-zi.yan@sent.com> (raw)
In-Reply-To: <20201119160605.1272425-1-zi.yan@sent.com>
From: Zi Yan <ziy@nvidia.com>
It sets memcg information for the pages after the split. A new parameter
new_order is added to tell the new page order, always 0 for now. It
prepares for upcoming changes to support split huge page to any lower order.
Signed-off-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>
Acked-by: Roman Gushchin <guro@fb.com>
---
include/linux/memcontrol.h | 5 +++--
mm/huge_memory.c | 2 +-
mm/memcontrol.c | 6 +++---
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index a8d5daf95988..39707feae505 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -1062,7 +1062,7 @@ static inline void memcg_memory_event_mm(struct mm_struct *mm,
}
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
-void mem_cgroup_split_huge_fixup(struct page *head);
+void mem_cgroup_split_huge_fixup(struct page *head, unsigned int new_order);
#endif
#else /* CONFIG_MEMCG */
@@ -1396,7 +1396,8 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order,
return 0;
}
-static inline void mem_cgroup_split_huge_fixup(struct page *head)
+static inline void mem_cgroup_split_huge_fixup(struct page *head,
+ unsigned int new_order)
{
}
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 88d8b7fce5d7..d7ab5cac5851 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2428,7 +2428,7 @@ static void __split_huge_page(struct page *page, struct list_head *list,
lruvec = mem_cgroup_page_lruvec(head, pgdat);
/* complete memcg works before add pages to LRU */
- mem_cgroup_split_huge_fixup(head);
+ mem_cgroup_split_huge_fixup(head, 0);
if (PageAnon(head) && PageSwapCache(head)) {
swp_entry_t entry = { .val = page_private(head) };
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index de5869dd354d..4521ed3a51b7 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3223,15 +3223,15 @@ void obj_cgroup_uncharge(struct obj_cgroup *objcg, size_t size)
* Because tail pages are not marked as "used", set it. We're under
* pgdat->lru_lock and migration entries setup in all page mappings.
*/
-void mem_cgroup_split_huge_fixup(struct page *head)
+void mem_cgroup_split_huge_fixup(struct page *head, unsigned int new_order)
{
struct mem_cgroup *memcg = page_memcg(head);
- int i;
+ int i, new_nr = 1 << new_order;
if (mem_cgroup_disabled())
return;
- for (i = 1; i < thp_nr_pages(head); i++) {
+ for (i = new_nr; i < thp_nr_pages(head); i += new_nr) {
css_get(&memcg->css);
head[i].memcg_data = (unsigned long)memcg;
}
--
2.28.0
next prev parent reply other threads:[~2020-11-19 16:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-19 16:05 [PATCH 0/7] Split huge pages to any lower order pages and selftests Zi Yan
2020-11-19 16:05 ` [PATCH 1/7] XArray: Fix splitting to non-zero orders Zi Yan
2020-11-19 16:06 ` [PATCH 2/7] mm: huge_memory: add new debugfs interface to trigger split huge page on any page range Zi Yan
2020-11-19 16:06 ` Zi Yan [this message]
2020-11-19 16:06 ` [PATCH 4/7] mm: page_owner: add support for splitting to any order in split page_owner Zi Yan
2020-11-19 16:06 ` [PATCH 5/7] mm: thp: split huge page to any lower order pages Zi Yan
2020-11-19 16:06 ` [PATCH 6/7] mm: truncate: split thp to a non-zero order if possible Zi Yan
2020-11-19 16:06 ` [PATCH 7/7] mm: huge_memory: enable debugfs to split huge pages to any order Zi Yan
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=20201119160605.1272425-4-zi.yan@sent.com \
--to=zi.yan@sent.com \
--cc=akpm@linux-foundation.org \
--cc=dnellans@nvidia.com \
--cc=guro@fb.com \
--cc=jhubbard@nvidia.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=rcampbell@nvidia.com \
--cc=shy828301@gmail.com \
--cc=willy@infradead.org \
--cc=ziy@nvidia.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