mm: page_alloc: simpify page del and expand
authorHuan Yang <link@vivo.com>
Mon, 26 Aug 2024 06:40:48 +0000 (14:40 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 9 Sep 2024 23:39:05 +0000 (16:39 -0700)
commit94deaf69dcd33462c61fa8cabb0883e3085a1046
tree023e6e80c8ea7ba9b9f6841853be25a461c5f852
parent536ab838a5b37b6ae3f8d53552560b7c51daeb41
mm: page_alloc: simpify page del and expand

When page del from buddy and need expand, it will account free_pages in
zone's migratetype.

The current way is to subtract the page number of the current order when
deleting, and then add it back when expanding.

This is unnecessary, as when migrating the same type, we can directly
record the difference between the high-order pages and the expand added,
and then subtract it directly.

This patch merge that, only when del and expand done, then account
free_pages.

Link: https://lkml.kernel.org/r/20240826064048.187790-1-link@vivo.com
Signed-off-by: Huan Yang <link@vivo.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/page_alloc.c