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=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 CBBC7C43331 for ; Thu, 2 Apr 2020 04:04:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8EED020747 for ; Thu, 2 Apr 2020 04:04:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="0/HjqiMs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8EED020747 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 419C48E001E; Thu, 2 Apr 2020 00:04:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3CB788E000D; Thu, 2 Apr 2020 00:04:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E1488E001E; Thu, 2 Apr 2020 00:04:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id 110CC8E000D for ; Thu, 2 Apr 2020 00:04:46 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C584345AB for ; Thu, 2 Apr 2020 04:04:45 +0000 (UTC) X-FDA: 76661573730.22.cave79_298d826b62a15 X-HE-Tag: cave79_298d826b62a15 X-Filterd-Recvd-Size: 3467 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Thu, 2 Apr 2020 04:04:45 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 54AD420747; Thu, 2 Apr 2020 04:04:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585800284; bh=qOR7sssnlB70VPbsXUZQZu+YtIvDYSnWipvciG0DXVE=; h=Date:From:To:Subject:In-Reply-To:From; b=0/HjqiMsX59zLjzBxqBEP+XPqqJCqwIPg7DX2s0z9MhINBLrehe5cs02vyBz7nPin 34N7C5CVU3h4r0AP9Oysq5+Tgmi3DFAIsZU8Z12sjmB1pf4j4uUckSXlnOO4XIVjHw JMSFfzSRYpxXZ68iT6XJ/YYCXYLHOfxaK8rcxwgM= Date: Wed, 01 Apr 2020 21:04:43 -0700 From: Andrew Morton To: akpm@linux-foundation.org, ira.weiny@intel.com, jack@suse.cz, linux-mm@kvack.org, mfo@canonical.com, mm-commits@vger.kernel.org, torvalds@linux-foundation.org Subject: [patch 030/155] mm/page-writeback.c: write_cache_pages(): deduplicate identical checks Message-ID: <20200402040443.RZ8EXB9WY%akpm@linux-foundation.org> In-Reply-To: <20200401210155.09e3b9742e1c6e732f5a7250@linux-foundation.org> User-Agent: s-nail v14.8.16 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: Mauricio Faria de Oliveira Subject: mm/page-writeback.c: write_cache_pages(): deduplicate identical checks 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(). Link: http://lkml.kernel.org/r/20200218221716.1648-1-mfo@canonical.com Signed-off-by: Mauricio Faria de Oliveira Reviewed-by: Ira Weiny Reviewed-by: Andrew Morton Cc: Jan Kara Signed-off-by: Andrew Morton --- mm/page-writeback.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/mm/page-writeback.c~mm-page-writebackc-write_cache_pages-deduplicate-identical-checks +++ a/mm/page-writeback.c @@ -2182,12 +2182,12 @@ int write_cache_pages(struct address_spa 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; _