From patchwork Sat Aug 13 07:52:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: CGEL X-Patchwork-Id: 12942700 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 A9BA9C25B08 for ; Sat, 13 Aug 2022 07:52:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F17AE8E0001; Sat, 13 Aug 2022 03:52:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EC7516B0075; Sat, 13 Aug 2022 03:52:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8E6D8E0001; Sat, 13 Aug 2022 03:52:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C6F4E6B0073 for ; Sat, 13 Aug 2022 03:52:30 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 991C540AE9 for ; Sat, 13 Aug 2022 07:52:30 +0000 (UTC) X-FDA: 79793802060.11.9DA916B Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by imf27.hostedemail.com (Postfix) with ESMTP id 2FB81401A5 for ; Sat, 13 Aug 2022 07:52:30 +0000 (UTC) Received: by mail-pf1-f176.google.com with SMTP id k14so2804530pfh.0 for ; Sat, 13 Aug 2022 00:52:29 -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; bh=BVeFtMFA/+Kv9HpmKKssuQiPaD1FxaNzd0BlFICyHyA=; b=isDTFt0C8pDp8R1tIQXeCPdcJca6J5ihyBkbai+4ufxh/7a9tnRVKRnzBV8KSwCgPS hq8NT3J+89Zwk7WvjB4BiLj9sFxKvF9POPd+Au4xmgGovAColBNaRLS0aF0HkuaL8VEr 2HPP1QjwKcAbCbftPb4nbbjO4SKvITlBVLi0fPw82bphUKSKRsX9pgLnU1cg+BpDNLuK EwmsbinUa2GgLO9ZD2++H5mkGlj5HWA3mkBPXmnJssVJgL3VnkaTWKQ/tdtWQeG9vxQ0 hlzC7srEWA6iLWv2HUkmeuwlAK0syU6ZtUwwBPV2fraE6AmP/+kLCq6GdEwZctLQuY2t xoBQ== 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; bh=BVeFtMFA/+Kv9HpmKKssuQiPaD1FxaNzd0BlFICyHyA=; b=xyLrZuuqrCHdy/2uD+ORi8LA6pxO385QND4fe73HCwXqjuNWcakZJDV1EiSPRgftn3 GH4PAb8ugIIGjnQNprGGr+tc2eCeVt1phpouO1Kms0tbnV9ak6rY941RdA4ByrvL/pZa +z84qouzblrRRUqyB1GYibcaiLXM6bAUvLi/EIQlui9FQg6JSU2vcAc3enxvgXSt5P6E uJCp7NGH/QHe11Ct3HziwMUFzf7egVdCWZtBCeTjnU75GyiVeJ+ZsofOu6GFxzOhVDTA t8qverXoy7OYACAGTP9G+Nfc7Ofs+jq2DTaSHluOYmR79eoOepQKtCtpf0b2flYoRMLI 4bgw== X-Gm-Message-State: ACgBeo2kNqHCbr0bZtcwbetQmXbriZ+KQNMU9VVBJw95aYDBfLcNDv4J GTg9DmlnW4GZk7XhsCLD1B4= X-Google-Smtp-Source: AA6agR4gjlHBh540xm1dDJ+cHnCQVHhbwFJsleq48spTWvy9nDF8TcgQRBmsoHOhy99S5IuE2rsuRg== X-Received: by 2002:a63:c5:0:b0:40d:d290:24ef with SMTP id 188-20020a6300c5000000b0040dd29024efmr6018064pga.141.1660377149105; Sat, 13 Aug 2022 00:52:29 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id f12-20020a170902e98c00b0016bee668a5asm3024553plb.161.2022.08.13.00.52.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Aug 2022 00:52:28 -0700 (PDT) From: cgel.zte@gmail.com X-Google-Original-From: yang.yang29@zte.com.cn To: akpm@linux-foundation.org, iamjoonsoo.kim@lge.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yang Yang , CGEL ZTE , Ran Xiaokai , wangyong Subject: [PATCH 2/2] mm/page_io: count submission time as thrashing delay for delayacct Date: Sat, 13 Aug 2022 07:52:08 +0000 Message-Id: <20220813075207.58493-1-yang.yang29@zte.com.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660377150; a=rsa-sha256; cv=none; b=MMFVwjd77faQTRXowLz3pLkxEBbql7bCSiMHOid7cIEL59VHUeXh8tTc2xc9eoZjohOfDj UX2m+xEKHPXfsFNr/2KlH1HiH9cc6zV2w+j1BwqPTPKFtl85cZ8NenkfTlhAnGOuBHHHY9 hKD1eh0AYNLsHI3ZapDSKHX7O+eqjIA= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=isDTFt0C; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.210.176 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660377150; 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=BVeFtMFA/+Kv9HpmKKssuQiPaD1FxaNzd0BlFICyHyA=; b=4GTOn3Z7Bh8Y13b2kZPBqYE7j7y6kGCeThA2AqNBDQyu5QNex8grwT4i1mI+e1Yo+6b8zR xpfuaHJxb732CKKKkVRKVtrWspmM42ucRlGNrPd+8IKXnhn/QUEmwqsMhQXkCUmJOqIzjp buvITIGxWjotfO3hYkmKgpNdZRwio68= X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 2FB81401A5 Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=isDTFt0C; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of cgel.zte@gmail.com designates 209.85.210.176 as permitted sender) smtp.mailfrom=cgel.zte@gmail.com X-Stat-Signature: 3x5a16s8ji8tduzffo13jt9u6gm7o8j9 X-Rspam-User: X-HE-Tag: 1660377150-423987 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: From: Yang Yang Once upon a time, we only support accounting thrashing of page cache. Then Joonsoo introduced workingset detection for anonymous pages and we gained the ability to account thrashing of them[1]. Likes PSI, we count submission time because When the device is congested, or the submitting cgroup IO-throttled, submission can be a significant part of overall IO time. This patch is based on "delayacct: support re-entrance detection of thrashing accounting". [1] commit aae466b0052e ("mm/swap: implement workingset detection for anonymous LRU") Signed-off-by: Yang Yang Signed-off-by: CGEL ZTE Cc: Joonsoo Kim Reviewed-by: Ran Xiaokai Reviewed-by: wangyong --- mm/page_io.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 68318134dc92..d2f5e0527af6 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -453,18 +453,21 @@ int swap_readpage(struct page *page, bool synchronous, struct swap_info_struct *sis = page_swap_info(page); bool workingset = PageWorkingset(page); unsigned long pflags; + unsigned long dflags; VM_BUG_ON_PAGE(!PageSwapCache(page) && !synchronous, page); VM_BUG_ON_PAGE(!PageLocked(page), page); VM_BUG_ON_PAGE(PageUptodate(page), page); /* - * Count submission time as memory stall. When the device is congested, - * or the submitting cgroup IO-throttled, submission can be a - * significant part of overall IO time. + * Count submission time as memory stall and delay. When the device + * is congested, or the submitting cgroup IO-throttled, submission + * can be a significant part of overall IO time. */ - if (workingset) + if (workingset) { + delayacct_thrashing_start(&dflags); psi_memstall_enter(&pflags); + } delayacct_swapin_start(); if (frontswap_load(page) == 0) { @@ -513,8 +516,10 @@ int swap_readpage(struct page *page, bool synchronous, bio_put(bio); out: - if (workingset) + if (workingset) { + delayacct_thrashing_end(&dflags); psi_memstall_leave(&pflags); + } delayacct_swapin_end(); return ret; }