From nobody Fri Dec 19 16:07:09 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8208CE79AC for ; Wed, 20 Sep 2023 09:40:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234048AbjITJkT (ORCPT ); Wed, 20 Sep 2023 05:40:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233999AbjITJkJ (ORCPT ); Wed, 20 Sep 2023 05:40:09 -0400 Received: from smtpbgbr1.qq.com (smtpbgbr1.qq.com [54.207.19.206]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92D91AF for ; Wed, 20 Sep 2023 02:40:02 -0700 (PDT) X-QQ-mid: bizesmtp74t1695202772tn02677e Received: from [10.23.230.53] ( [121.46.247.130]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 20 Sep 2023 17:38:50 +0800 (CST) X-QQ-SSF: 01400000000000101000000A0000000 X-QQ-FEAT: vrqOr+ppv0sOrG/PUzmadjlzcJfWoUqZsFhBWAm5zn1sikR/Q/rd4MGQJXch0 cuoSfOXHIBii+lU45P553185ZJk8s7C6HwrhMjnhpImBMzsZ+KT6DTBYTUH7MS+ftXfZPIM tZ5MW5OUVUwOKcE1PajYjUC+5eQVTQHHmzZkpU6fdu1fXOsyi1Oe86QOrt9sm0fP+8+Ti/d giXrZ7BRYEwW0dP0yJapC40qVmQz7KpyWa6tuL81KiBzBlKcLTY/ONaTPfBxBQhV2xAO4kq NVPBN3grP/71hu0vf5sh5DzKt8W75N6kEgezJ90Mf6OtgPd1WV5D+EHSukSl55Vbhi8TVJw sYvrIYIzXO/C5w815zRkkRSc9YbplMReWY10q9EzP/A2h6HcEi1GtmSKi6iYw== X-QQ-GoodBg: 2 X-BIZMAIL-ID: 17908884623268010789 Message-ID: <181C946095F0252B+7cc60eca-1abf-4502-aad3-ffd8ef89d910@ex.bilibili.com> Date: Wed, 20 Sep 2023 17:38:49 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: liwenyu Subject: [PATCH] delayacct: add memory reclaim delay in get_page_from_freelist Organization: bilibili To: akpm@linux-foundation.org Cc: bsingharora@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, wangyun@bilibili.com Content-Transfer-Encoding: quoted-printable X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:ex.bilibili.com:qybglogicsvrsz:qybglogicsvrsz3a-0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8"; format="flowed" The current memory reclaim delay statistics only count the direct memory reclaim of the task in do_try_to_free_pages(). In systems with NUMA open, some tasks occasionally experience slower response times, but the total count of reclaim does not increase, using ftrace can show that node_reclaim has occurred. The memory reclaim occurring in get_page_from_freelist() is also due to heavy memory load. To get the impact of tasks in memory reclaim, this patch adds the statistics of the memory reclaim delay statistics for __node_reclaim(). Signed-off-by: Wen Yu Li --- mm/vmscan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/vmscan.c b/mm/vmscan.c index 6f13394b112e..88be3dedc584 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -8026,6 +8026,7 @@ static int __node_reclaim(struct pglist_data=20 *pgdat, gfp_t gfp_mask, unsigned in cond_resched(); psi_memstall_enter(&pflags); + delayacct_freepages_start(); fs_reclaim_acquire(sc.gfp_mask); /* * We need to be able to allocate from the reserves for RECLAIM_UNMAP @@ -8048,6 +8049,7 @@ static int __node_reclaim(struct pglist_data=20 *pgdat, gfp_t gfp_mask, unsigned in memalloc_noreclaim_restore(noreclaim_flag); fs_reclaim_release(sc.gfp_mask); psi_memstall_leave(&pflags); + delayacct_freepages_end(); trace_mm_vmscan_node_reclaim_end(sc.nr_reclaimed); --=20 2.30.2