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 E193EC433F5 for ; Thu, 31 Mar 2022 08:02:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E6A936B0072; Thu, 31 Mar 2022 04:02:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E18406B0073; Thu, 31 Mar 2022 04:02:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CDFE08D0001; Thu, 31 Mar 2022 04:02:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id BE2546B0072 for ; Thu, 31 Mar 2022 04:02:31 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5056361E2C for ; Thu, 31 Mar 2022 08:02:31 +0000 (UTC) X-FDA: 79303939302.15.9F6A010 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by imf25.hostedemail.com (Postfix) with ESMTP id 1330EA0003 for ; Thu, 31 Mar 2022 08:02:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648713750; x=1680249750; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=eBg9UJ10yPGgoudu4x1qv1vFubx6B7Wlrl2Xo90m9tQ=; b=lyBmxV61pPOJ4mpeK/x2PdZYeXUDp3xU0be9LIJYlBtEmGNKeKf4ISdH 7i5I+9op7aBQW6aUuOraGAnneGmAOXMEo4g0MXNavJRFSvPhDWKDZI88K y/ZGK3WI9jqxmjsLnHxRAlb5shByi4plmVRhxORDqolgvfnz+jddWO3hu 93LhA//V/DG4owMtRgJEMeEgzseZtd8pLzBXmRUMWVpia7bvC/pw5Z7z4 LHJjQewwgo7qVdl3+dvO5ui059NcWsKIf5e8zGguV59T8hpRQGOiHk/DH 3O3eGVuyvA4DsY7yT4vw08486+z1Un5C5o36jSzG1RaDuecDubGf1QiKm g==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="239677504" X-IronPort-AV: E=Sophos;i="5.90,224,1643702400"; d="scan'208";a="239677504" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2022 01:02:28 -0700 X-IronPort-AV: E=Sophos;i="5.90,224,1643702400"; d="scan'208";a="547211378" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.239.13.94]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2022 01:02:26 -0700 From: "Huang, Ying" To: Miaohe Lin Cc: Andrew Morton , Linux Memory Management List , LKML , Muchun Song Subject: Re: [PATCH 1/8] mm/vmscan: remove redundant folio_test_swapbacked check when folio is file lru References: <20220329132619.18689-1-linmiaohe@huawei.com> <20220329132619.18689-2-linmiaohe@huawei.com> <87lewqbpad.fsf@yhuang6-desk2.ccr.corp.intel.com> <7c8d06f6-ac41-d3d7-f6b6-20a06e56dc61@huawei.com> Date: Thu, 31 Mar 2022 16:02:24 +0800 In-Reply-To: <7c8d06f6-ac41-d3d7-f6b6-20a06e56dc61@huawei.com> (Miaohe Lin's message of "Thu, 31 Mar 2022 15:44:03 +0800") Message-ID: <87czi2bldb.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=lyBmxV61; spf=none (imf25.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 192.55.52.136) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Stat-Signature: fjsr5orkqyu1kctwmmyj65wpqd98n3b4 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 1330EA0003 X-HE-Tag: 1648713749-204803 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: Miaohe Lin writes: > On 2022/3/31 14:37, Huang, Ying wrote: >> Muchun Song writes: >> >>> On Tue, Mar 29, 2022 at 9:26 PM Miaohe Lin wrote: >>>> >>>> When folio is file lru, folio_test_swapbacked is guaranteed to be true. So >>>> it's unnecessary to check it here again. No functional change intended. >>>> >>>> Signed-off-by: Miaohe Lin >>>> --- >>>> mm/vmscan.c | 3 +-- >>>> 1 file changed, 1 insertion(+), 2 deletions(-) >>>> >>>> diff --git a/mm/vmscan.c b/mm/vmscan.c >>>> index 1678802e03e7..7c1a9713bfc9 100644 >>>> --- a/mm/vmscan.c >>>> +++ b/mm/vmscan.c >>>> @@ -1434,8 +1434,7 @@ static void folio_check_dirty_writeback(struct folio *folio, >>>> * Anonymous pages are not handled by flushers and must be written >>>> * from reclaim context. Do not stall reclaim based on them >>>> */ >>>> - if (!folio_is_file_lru(folio) || >>>> - (folio_test_anon(folio) && !folio_test_swapbacked(folio))) { >>>> + if (!folio_is_file_lru(folio) || folio_test_anon(folio)) { >>> >>> At least your login is no problem since folio_is_file_lru() is equal to >>> !folio_test_swapbacked(). But the new code is not clear to me. >>> The old code is easy to understand, e.g. folio_test_anon(folio) && >>> !folio_test_swapbacked(folio) tells us that the anon pages which >>> do not need to be swapped should be skipped. >> >> That is for MADV_FREE pages. The code is introduced in commit >> 802a3a92ad7a ("mm: reclaim MADV_FREE pages"). >> >> So I think the original code is better. It's an implementation detail >> that folio_is_file_lru() equals !folio_test_swapbacked(). It may be >> better to add some comments here for MADV_FREE pages. >> > > Do you tend to drop this patch or adding a comment with the change in this patch or something else? I suggest to drop the code change and add a comment about MADV_FREE. Best Regards, Huang, Ying > Thanks. > >>> So I'm neutral on the patch. >> >> Best Regards, >> Huang, Ying >> . >>