diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2024-02-27 17:42:39 +0000 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2024-03-04 17:01:23 -0800 |
commit | 4882c80975e2bf7241a5b043eb1dbe8df2726a29 (patch) | |
tree | 68288c41d6a2375f0025776a999441e56ad88d1a /mm/memcontrol.c | |
parent | 6871cc5742f411bf8ebbcb78b4afeb992d888228 (diff) |
memcg: add mem_cgroup_uncharge_folios()
Almost identical to mem_cgroup_uncharge_list(), except it takes a
folio_batch instead of a list_head.
Link: https://lkml.kernel.org/r/20240227174254.710559-6-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Ryan Roberts <ryan.roberts@arm.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index e4864e2729e6..2edb250d131b 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -33,6 +33,7 @@ #include <linux/shmem_fs.h> #include <linux/hugetlb.h> #include <linux/pagemap.h> +#include <linux/pagevec.h> #include <linux/vm_event_item.h> #include <linux/smp.h> #include <linux/page-flags.h> @@ -7531,6 +7532,18 @@ void __mem_cgroup_uncharge_list(struct list_head *page_list) uncharge_batch(&ug); } +void __mem_cgroup_uncharge_folios(struct folio_batch *folios) +{ + struct uncharge_gather ug; + unsigned int i; + + uncharge_gather_clear(&ug); + for (i = 0; i < folios->nr; i++) + uncharge_folio(folios->folios[i], &ug); + if (ug.memcg) + uncharge_batch(&ug); +} + /** * mem_cgroup_replace_folio - Charge a folio's replacement. * @old: Currently circulating folio. |