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 X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 5ACB6C3404D for ; Wed, 19 Feb 2020 00:20:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2660524654 for ; Wed, 19 Feb 2020 00:20:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2660524654 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 978166B0005; Tue, 18 Feb 2020 19:20:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 928926B0006; Tue, 18 Feb 2020 19:20:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 83D0E6B0007; Tue, 18 Feb 2020 19:20:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0227.hostedemail.com [216.40.44.227]) by kanga.kvack.org (Postfix) with ESMTP id 6DA216B0005 for ; Tue, 18 Feb 2020 19:20:08 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 2EB85181AEF15 for ; Wed, 19 Feb 2020 00:20:08 +0000 (UTC) X-FDA: 76504969296.02.camp97_586b64a2a152d X-HE-Tag: camp97_586b64a2a152d X-Filterd-Recvd-Size: 3422 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Wed, 19 Feb 2020 00:20:07 +0000 (UTC) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Feb 2020 16:20:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,458,1574150400"; d="scan'208";a="258738236" Received: from iweiny-desk2.sc.intel.com ([10.3.52.157]) by fmsmga004.fm.intel.com with ESMTP; 18 Feb 2020 16:20:05 -0800 Date: Tue, 18 Feb 2020 16:20:05 -0800 From: Ira Weiny To: Mauricio Faria de Oliveira Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mm/page-writeback.c: write_cache_pages(): deduplicate identical checks Message-ID: <20200219002004.GC14509@iweiny-DESK2.sc.intel.com> References: <20200218221716.1648-1-mfo@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200218221716.1648-1-mfo@canonical.com> User-Agent: Mutt/1.11.1 (2018-12-01) 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: On Tue, Feb 18, 2020 at 07:17:16PM -0300, Mauricio Faria de Oliveira wrote: > 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 Reviewed-by: Ira Weiny > --- > > 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 *mapping, > if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) > range_whole = 1; > } > - if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages) > + if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages) { > + tag_pages_for_writeback(mapping, index, end); > tag = PAGECACHE_TAG_TOWRITE; > - else > + } else { > tag = PAGECACHE_TAG_DIRTY; > - if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages) > - tag_pages_for_writeback(mapping, index, end); > + } > done_index = index; > while (!done && (index <= end)) { > int i; > -- > 2.20.1 >