From patchwork Thu Oct 6 10:15:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yafang Shao X-Patchwork-Id: 13000104 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 575A7C433FE for ; Thu, 6 Oct 2022 10:15:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7BB508E0002; Thu, 6 Oct 2022 06:15:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 769158E0001; Thu, 6 Oct 2022 06:15:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 630D18E0002; Thu, 6 Oct 2022 06:15:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 4DAB88E0001 for ; Thu, 6 Oct 2022 06:15:52 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 040D21A10AB for ; Thu, 6 Oct 2022 10:15:51 +0000 (UTC) X-FDA: 79990118544.20.9C733F7 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by imf13.hostedemail.com (Postfix) with ESMTP id 5F23520006 for ; Thu, 6 Oct 2022 10:15:50 +0000 (UTC) Received: by mail-pf1-f179.google.com with SMTP id w191so1630407pfc.5 for ; Thu, 06 Oct 2022 03:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=fnPbpVv+V4+hKw5wFQNnGWEUcCAlSeVs0KMwd4mafWg=; b=QQq4ByzSixPAl4f1KhV9ozDCYiSsTpT8uUcymvLvS6PrPbERrb/5FiLm09sOKvnuCg nmruhtghMKZLcbM56z7+HBWzjgykgu4z3zKchAgboOK08ja5Ej40sEgIQzysWZwi7BFi cmQslcAMv2xwAYwh0Yy6zlkuNfE7a8XgOuCINpTwHorFVzxd8Do3py1ySKJL+guYPd3H gLTNJ60KUHc+xu2NNLPZ+k6OuY2jj486rwe2HSfynf3k6FBm0U2pPHWVWUQXBwRC0QXE 3ZlVtwGQs/j0obIpbjNf9wYZeVEl025+34IuRVYrLhKsDhHvxITFWhod9MuIeN+oYylg a0MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fnPbpVv+V4+hKw5wFQNnGWEUcCAlSeVs0KMwd4mafWg=; b=zuAuqpOUc4j3hx5sbY0Gh1VxRx8KO/f70Js9UcGWdprRxoFLWO6GH4pxQNWzYOXQzO PYDeBrEFVFBUoz3nWGHyAYDoTWawX8//bFw2aRf46bJm527w6KUAixoKH6ksIjpG2+t0 s1FHBatseWIdAzUuuHy0S+RIyLxyuML9Vn2ON+18CZGQyV26qpYh5E8tzlA0dz7l3cCY qhhev+tRnXbhhIhGItR2T1NqQpNz83hqVYwaTC5kdzxQ6g1qPivBrh06O7mc8QMsSmKg cICgOv7ZWu0OiWIkNixPyhC5lp2KyOdvp1kPsADdiiD57RQpkCZMwNyxtBLEjR4MhLEU mPvw== X-Gm-Message-State: ACrzQf2AJMQK2+IcLJqCoDAfJnNYAw9kO7udP9neAfbclp8ZqBzjySrR 4KhdhBEAoohAzQXWPoyonlI= X-Google-Smtp-Source: AMsMyM52O/m6QoZubqppNpoY8JQVyN9IMeOrcpsdD0xKTVvG8aA/qVSDlm1NJ/Yvsw/JY3cJq5UDQw== X-Received: by 2002:a63:e00a:0:b0:43c:7f5c:822b with SMTP id e10-20020a63e00a000000b0043c7f5c822bmr3756036pgh.307.1665051349258; Thu, 06 Oct 2022 03:15:49 -0700 (PDT) Received: from vultr.guest ([2001:19f0:6001:3cbb:5400:4ff:fe29:8403]) by smtp.gmail.com with ESMTPSA id c135-20020a624e8d000000b0054223a0185asm12443133pfb.161.2022.10.06.03.15.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 03:15:48 -0700 (PDT) From: Yafang Shao To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, Yafang Shao , Mel Gorman Subject: [PATCH] mm/page_alloc: Fix incorrect PGFREE and PGALLOC for high-order page Date: Thu, 6 Oct 2022 10:15:40 +0000 Message-Id: <20221006101540.40686-1-laoar.shao@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665051350; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=fnPbpVv+V4+hKw5wFQNnGWEUcCAlSeVs0KMwd4mafWg=; b=x+fajWX/d+v31bWdduAv8Ssm2pNMQn28Wsjaeto/N0nB10ZU9p/X2X+E8NPseQZBpSdIPd R1zfnEbdCYj4oUd25+v7CehVgVY9osR07p9QS65WCrvleoTCMpnjFATgy6vUYJ1mmw8ZFM Ga5bI2Sj+kvgtfGLFywyuuhy8zMWwuQ= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=QQq4ByzS; spf=pass (imf13.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.210.179 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665051350; a=rsa-sha256; cv=none; b=5QvTgEBHXhFRApxsFZ4DZ3pXsETAZjPp1DSU/DlIHgbg5sjjwDdKPP7AG5kJCOfNkYW1uv Z+xeHzmvqYxMGTiBI1l0igBVNl97ppl7xhQo/pgQVN+08KOTgZWDiKB1e/Nhc7Y1xJbdHQ GV8bTJA7M/Lsr8zPpj/Y77yXV+M28VQ= Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=QQq4ByzS; spf=pass (imf13.hostedemail.com: domain of laoar.shao@gmail.com designates 209.85.210.179 as permitted sender) smtp.mailfrom=laoar.shao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 5F23520006 X-Rspam-User: X-Stat-Signature: ej9wmz7c8u5iznun5kdsjhdkwh6zdess X-HE-Tag: 1665051350-226408 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: PGFREE and PGALLOC represent the number of freed and allocated pages. So the page order must be considered. Fixes: 44042b449872 ("mm/page_alloc: allow high-order pages to be stored on the per-cpu lists") Signed-off-by: Yafang Shao Cc: Mel Gorman Acked-by: Mel Gorman Reviewed-by: Miaohe Lin --- mm/page_alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e5486d4..3c0ee3b 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3440,7 +3440,7 @@ static void free_unref_page_commit(struct zone *zone, struct per_cpu_pages *pcp, int pindex; bool free_high; - __count_vm_event(PGFREE); + __count_vm_events(PGFREE, 1 << order); pindex = order_to_pindex(migratetype, order); list_add(&page->pcp_list, &pcp->lists[pindex]); pcp->count += 1 << order; @@ -3808,7 +3808,7 @@ static struct page *rmqueue_pcplist(struct zone *preferred_zone, pcp_spin_unlock_irqrestore(pcp, flags); pcp_trylock_finish(UP_flags); if (page) { - __count_zid_vm_events(PGALLOC, page_zonenum(page), 1); + __count_zid_vm_events(PGALLOC, page_zonenum(page), 1 << order); zone_statistics(preferred_zone, zone, 1); } return page;