Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2400EC3404C for ; Tue, 18 Feb 2020 22:17:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C3A312067D for ; Tue, 18 Feb 2020 22:17:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C3A312067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4A53C6B0005; Tue, 18 Feb 2020 17:17:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 47C176B0006; Tue, 18 Feb 2020 17:17:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B86B6B0007; Tue, 18 Feb 2020 17:17:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0025.hostedemail.com [216.40.44.25]) by kanga.kvack.org (Postfix) with ESMTP id 226186B0005 for ; Tue, 18 Feb 2020 17:17:25 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D98A4181AC9C6 for ; Tue, 18 Feb 2020 22:17:24 +0000 (UTC) X-FDA: 76504660008.06.week24_238dd66dc5a2c X-HE-Tag: week24_238dd66dc5a2c X-Filterd-Recvd-Size: 4467 Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Tue, 18 Feb 2020 22:17:24 +0000 (UTC) Received: from mail-qv1-f70.google.com ([209.85.219.70]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1j4BBC-0008R3-Mr for linux-mm@kvack.org; Tue, 18 Feb 2020 22:17:22 +0000 Received: by mail-qv1-f70.google.com with SMTP id v3so13380398qvm.2 for ; Tue, 18 Feb 2020 14:17:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ePSzxjRqtz2vpkYpI6b9sCEQoHO2KCvSWV7iBfKgM9M=; b=l+fxnF47MgPwY7D2qVVa9p2XunNtzVAl5N311hFtz3+syaQNrgLtYLX+w6O+n3k/AG HgrrRyQBOMvYZKoYAc4JJ+/g6z5Y0czdFU4yBuSrgexr+IfB5M0QA/U2exAfgboUjPWL 0aMoRC1WlsmAivk6VlZ5YBqnXRqrhWN6QMMliDQziK1bD13zdrFB3xVQOb1ZvubuPVv2 T6bGZsjuXbnlt8FXf/jeTxp9ryV+inkLSvhQTBhqp3dQTBbtEeppUKFZLcz1Bifbs0u4 ZoufGeMuHsAT5aQIKS0IfGTlXzvV6L0HL84pNQIgjMxf8WPeGY8nN9XasKPkUM5pUQHj 5ZBA== X-Gm-Message-State: APjAAAVpi4B7qqOuvnhP9IctO4bGJhtbGJYSOVI/tEOEwwiHZRVIRZuo 8mqzUnbuRIoOFdKUVpufOjyQbIx8isweBXbo4LSNH4ArPJtNDinv8v3ysVnF5Wbvm9H4UjYYpie i0i/L4JZ0f0RDCzYJn6PrRZ67sDpD X-Received: by 2002:a37:7a06:: with SMTP id v6mr21410912qkc.378.1582064241206; Tue, 18 Feb 2020 14:17:21 -0800 (PST) X-Google-Smtp-Source: APXvYqz+liMLysEyoFnIHvLaJknNLKj4RrPLdl1EOo4buQMOqwMnaMHjyc1bR+LTw+8iQ1LqG6L+5A== X-Received: by 2002:a37:7a06:: with SMTP id v6mr21410895qkc.378.1582064240957; Tue, 18 Feb 2020 14:17:20 -0800 (PST) Received: from localhost.localdomain ([2804:14c:4e7:1017:1c35:828a:99a9:563b]) by smtp.gmail.com with ESMTPSA id e130sm8172qkb.72.2020.02.18.14.17.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2020 14:17:20 -0800 (PST) From: Mauricio Faria de Oliveira To: Andrew Morton , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH v2] mm/page-writeback.c: write_cache_pages(): deduplicate identical checks Date: Tue, 18 Feb 2020 19:17:16 -0300 Message-Id: <20200218221716.1648-1-mfo@canonical.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: There used to be a 'retry' label in between the two (identical) checks when first introduced in commit f446daaea9d4 ("mm: implement writeback livelock avoidance using page tagging"), and later modified/updated in commit 6e6938b6d313 ("writeback: introduce .tagged_writepages for the WB_SYNC_NONE sync stage"). The label has been removed in commit 64081362e8ff ("mm/page-writeback.c: fix range_cyclic writeback vs writepages deadlock"), and the (identical) checks are now present / performed immediately one after another. So, remove/deduplicate the latter check, moving tag_pages_for_writeback() into the former check before the 'tag' variable assignment, so it's clear that it's not used in this (similarly-named) function call but only later in pagevec_lookup_range_tag(). Signed-off-by: Mauricio Faria de Oliveira --- v2: add the missing braces to the conditional statement with more than a single statement.. doh; and to the else branch (w/a single statement, per coding style.) mm/page-writeback.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 2caf780a42e7..ab5a3cee8ad3 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2182,12 +2182,12 @@ int write_cache_pages(struct address_space *mappi= ng, if (wbc->range_start =3D=3D 0 && wbc->range_end =3D=3D LLONG_MAX) range_whole =3D 1; } - if (wbc->sync_mode =3D=3D WB_SYNC_ALL || wbc->tagged_writepages) + if (wbc->sync_mode =3D=3D WB_SYNC_ALL || wbc->tagged_writepages) { + tag_pages_for_writeback(mapping, index, end); tag =3D PAGECACHE_TAG_TOWRITE; - else + } else { tag =3D PAGECACHE_TAG_DIRTY; - if (wbc->sync_mode =3D=3D WB_SYNC_ALL || wbc->tagged_writepages) - tag_pages_for_writeback(mapping, index, end); + } done_index =3D index; while (!done && (index <=3D end)) { int i; --=20 2.20.1