Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6405461ybv; Tue, 18 Feb 2020 16:21:12 -0800 (PST) X-Google-Smtp-Source: APXvYqz1spus7dNlzN4MnQSgnr6smwSictRL4u7DtVr94f1PMVMC+xDHaujENI/H6hj/g/RBfUSQ X-Received: by 2002:a05:6808:aac:: with SMTP id r12mr3034991oij.59.1582071672748; Tue, 18 Feb 2020 16:21:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582071672; cv=none; d=google.com; s=arc-20160816; b=vvPslUV/Ab3aw8sAljnFUoUbaZM7t13A27GXANrueY6PwemcWDCMqjXjYgX4d8kGPE bhpQcJrJ/FXOW+DgQlbEquKKPpCfn8LYo5JjWyCHd6XZVOuZ6KteCvp4biO14EtQthsQ DT9sMfb8iS3dyTUZsPNZtcxeecUKh7LCtOCVhG3Iaa9Tw2nnqRIqFWk6Vvh0fd2YGOkV fJJRYmQ0fJrc0pgdzA1QJ70wlKtyop6uU/hGjWdnCPEuVsmnShP8/m5vaT5NlInTWFOa e7ZKPXzBz/apSSvN0o6fThDlrbTBoI2JI8x7/egoTAxTOc9NmwEEoS3ZleFMG1ACZy4N uALw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=TYw4p3l/RKQdETf+mfW3oI0gnE8KkQA+rp+qvhwOlIs=; b=U90359Wi7Yy6f5qcX7LK5mqIXZSNrfnT339x51N1hLKb/dG0Y4nu9mhqF2n4WhMdrT N4Thwpj0G23gJMCXuPJKfoGqNCBpaUOMELFlgGKMuUMdLutMdEl9WeLKiXZHgSY/6Y/D 7DPMbDbdkKcv9lrEdHYsAaPlolSvCb6c3gvJatb3Zw0zXvGKlGBAL0BaGOXDvn0vcsxX biJQYT0+zKLig/L4Q0Z9HmK4lqTMQr0RKtaEfZVgTaa9MQgo8LPEuGIKW+/QQLmShueg k3d7ksOvBsBTxyn6Ug4uUKnyH3eaY2uLIBDO0HS7OFtqDpXy/oXM1NjPE1bKXc5PW5jo SsDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t20si220285otr.64.2020.02.18.16.20.55; Tue, 18 Feb 2020 16:21:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726863AbgBSAUH (ORCPT + 99 others); Tue, 18 Feb 2020 19:20:07 -0500 Received: from mga14.intel.com ([192.55.52.115]:62347 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726521AbgBSAUH (ORCPT ); Tue, 18 Feb 2020 19:20:07 -0500 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 fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Feb 2020 16:20:06 -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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >