summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKemeng Shi <shikemeng@huaweicloud.com>2023-08-09 13:07:54 +0300
committerAndrew Morton <akpm@linux-foundation.org>2023-08-21 23:37:50 +0300
commit1305870529d9e16170bb744148aab6dffb19bb23 (patch)
tree24abb6ef2f211d24a4d6dfd7dd725f492cad52ee
parentf142b2c2530c1383a45e1ada1d641974b9723a35 (diff)
downloadlinux-1305870529d9e16170bb744148aab6dffb19bb23.tar.xz
mm/page_alloc: remove unnecessary parameter batch of nr_pcp_free
We get batch from pcp and just pass it to nr_pcp_free immediately. Get batch from pcp inside nr_pcp_free to remove unnecessary parameter batch. Link: https://lkml.kernel.org/r/20230809100754.3094517-3-shikemeng@huaweicloud.com Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> Cc: Baolin Wang <baolin.wang@linux.alibaba.com> Cc: David Hildenbrand <david@redhat.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Mel Gorman <mgorman@techsingularity.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--mm/page_alloc.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index bc782bffaf02..cfadde2fe3a2 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2340,10 +2340,10 @@ static bool free_unref_page_prepare(struct page *page, unsigned long pfn,
return true;
}
-static int nr_pcp_free(struct per_cpu_pages *pcp, int high, int batch,
- bool free_high)
+static int nr_pcp_free(struct per_cpu_pages *pcp, int high, bool free_high)
{
int min_nr_free, max_nr_free;
+ int batch = READ_ONCE(pcp->batch);
/* Free everything if batch freeing high-order pages. */
if (unlikely(free_high))
@@ -2410,9 +2410,7 @@ static void free_unref_page_commit(struct zone *zone, struct per_cpu_pages *pcp,
high = nr_pcp_high(pcp, zone, free_high);
if (pcp->count >= high) {
- int batch = READ_ONCE(pcp->batch);
-
- free_pcppages_bulk(zone, nr_pcp_free(pcp, high, batch, free_high), pcp, pindex);
+ free_pcppages_bulk(zone, nr_pcp_free(pcp, high, free_high), pcp, pindex);
}
}