Skip to content

Commit

Permalink
mm/page_alloc: remove unnecessary parameter batch of nr_pcp_free
Browse files Browse the repository at this point in the history
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/[email protected]
Signed-off-by: Kemeng Shi <[email protected]>
Cc: Baolin Wang <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: Mel Gorman <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
Kemeng Shi authored and akpm00 committed Aug 21, 2023
1 parent f142b2c commit 1305870
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 1305870

Please sign in to comment.