From mboxrd@z Thu Jan 1 00:00:00 1970 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 E6531C43334 for ; Thu, 16 Jun 2022 21:25:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7EAFE6B0087; Thu, 16 Jun 2022 17:25:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 79A2E6B0088; Thu, 16 Jun 2022 17:25:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 63B5B6B0089; Thu, 16 Jun 2022 17:25:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 5479D6B0087 for ; Thu, 16 Jun 2022 17:25:21 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 26633679 for ; Thu, 16 Jun 2022 21:25:21 +0000 (UTC) X-FDA: 79585380042.16.92EA92D Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by imf22.hostedemail.com (Postfix) with ESMTP id A0530C008C for ; Thu, 16 Jun 2022 21:25:20 +0000 (UTC) Received: from pps.filterd (m0109332.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25GKPWlh032025 for ; Thu, 16 Jun 2022 14:25:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=facebook; bh=kEVeF1raHjzqCCTZ1PYGpmk3OQwPxUvEougAHhggs/M=; b=G1MjJwdD5PalkJ2RTEk/KfUzsOeYWuUlma+oPKFKpQ10w0YVrYt9iGcUjc7ANb+h1j+R v8/AZfHpMDDO+BlylzMdXyH/rM3Pd36Ge3cTOGVRRAnwGIhM86SyBGZQWOQdAD01NEFf 6oUF+vy4oC6mVF9DCdJy5ZCu+MvUPytlLEw= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3gqxc5yhpt-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 16 Jun 2022 14:25:19 -0700 Received: from twshared5131.09.ash9.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 16 Jun 2022 14:25:17 -0700 Received: by devvm225.atn0.facebook.com (Postfix, from userid 425415) id 93E6F108B7095; Thu, 16 Jun 2022 14:22:23 -0700 (PDT) From: Stefan Roesch To: , , , , CC: , , , , , Subject: [PATCH v9 02/14] mm: Move updates of dirty_exceeded into one place Date: Thu, 16 Jun 2022 14:22:09 -0700 Message-ID: <20220616212221.2024518-3-shr@fb.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220616212221.2024518-1-shr@fb.com> References: <20220616212221.2024518-1-shr@fb.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-GUID: GTK_qDuMBfQeuVQXZslTlw9-2T9RcVjo X-Proofpoint-ORIG-GUID: GTK_qDuMBfQeuVQXZslTlw9-2T9RcVjo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.64.514 definitions=2022-06-16_18,2022-06-16_01,2022-02-23_01 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655414720; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=kEVeF1raHjzqCCTZ1PYGpmk3OQwPxUvEougAHhggs/M=; b=UgbOvQBdMajUd+lR++sapiqgGVLCdGj6wGbzBB5gRdaJfi64t9yItxkwO87twsK9xrzWTL +Az4SBnp3iOp8Mf0xSzouRLY8i7b8oxZ1f9lufi9mt6qANu5HE+j9w+Ry4tYLIAG8hpdj1 fj4RyzDjode/xZmg1t6rJu33rZBVoyk= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=fb.com header.s=facebook header.b=G1MjJwdD; spf=none (imf22.hostedemail.com: domain of "prvs=7166657324=shr@fb.com" has no SPF policy when checking 67.231.153.30) smtp.mailfrom="prvs=7166657324=shr@fb.com"; dmarc=pass (policy=reject) header.from=fb.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655414720; a=rsa-sha256; cv=none; b=Nt0kE0CH6OlDdwTA54vd7OrY9JRT412bfWEPabYAiZOHJzdNIYk2Z9VH8U4QMZuaOmGg4P FZ6UyDLevkFfJ3v4HpX+kycX3DzZIhoYOcaZOP2oSwX3ZLXWpZXdILsA20FfVICaP4WLgP 1XAJVoSkE9FW4CqUse81vvrcb+HDaS8= X-Stat-Signature: m3rsqxmgrk3xiwf8u5gphwfzdgxmbjcp X-Rspamd-Queue-Id: A0530C008C X-Rspamd-Server: rspam11 X-Rspam-User: Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=fb.com header.s=facebook header.b=G1MjJwdD; spf=none (imf22.hostedemail.com: domain of "prvs=7166657324=shr@fb.com" has no SPF policy when checking 67.231.153.30) smtp.mailfrom="prvs=7166657324=shr@fb.com"; dmarc=pass (policy=reject) header.from=fb.com X-HE-Tag: 1655414720-202698 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: Jan Kara Transition of wb->dirty_exceeded from 0 to 1 happens before we go to sleep in balance_dirty_pages() while transition from 1 to 0 happens when exiting from balance_dirty_pages(), possibly based on old values. This does not make a lot of sense since wb->dirty_exceeded should simply reflect whether wb is over dirty limit and so we should ratelimit entering to balance_dirty_pages() less. Move the two updates together. Signed-off-by: Jan Kara Signed-off-by: Stefan Roesch --- mm/page-writeback.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index e59c523aed1a..90b1998c16a1 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -1729,8 +1729,8 @@ static void balance_dirty_pages(struct bdi_writebac= k *wb, sdtc =3D mdtc; } =20 - if (dirty_exceeded && !wb->dirty_exceeded) - wb->dirty_exceeded =3D 1; + if (dirty_exceeded !=3D wb->dirty_exceeded) + wb->dirty_exceeded =3D dirty_exceeded; =20 if (time_is_before_jiffies(READ_ONCE(wb->bw_time_stamp) + BANDWIDTH_INTERVAL)) @@ -1834,9 +1834,6 @@ static void balance_dirty_pages(struct bdi_writebac= k *wb, if (fatal_signal_pending(current)) break; } - - if (!dirty_exceeded && wb->dirty_exceeded) - wb->dirty_exceeded =3D 0; } =20 static DEFINE_PER_CPU(int, bdp_ratelimits); --=20 2.30.2