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=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 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 122FFC433E6 for ; Wed, 24 Feb 2021 09:01:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4651864EBB for ; Wed, 24 Feb 2021 09:01:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4651864EBB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AC5636B006E; Wed, 24 Feb 2021 04:01:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A76106B0070; Wed, 24 Feb 2021 04:01:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 98BA86B0071; Wed, 24 Feb 2021 04:01:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0162.hostedemail.com [216.40.44.162]) by kanga.kvack.org (Postfix) with ESMTP id 82E906B006E for ; Wed, 24 Feb 2021 04:01:29 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 46A721804E3A0 for ; Wed, 24 Feb 2021 09:01:29 +0000 (UTC) X-FDA: 77852567898.15.C529408 Received: from out30-42.freemail.mail.aliyun.com (out30-42.freemail.mail.aliyun.com [115.124.30.42]) by imf15.hostedemail.com (Postfix) with ESMTP id 89A6EA0000FF for ; Wed, 24 Feb 2021 09:01:24 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R611e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0UPRGegh_1614157280; Received: from IT-FVFX43SYHV2H.local(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0UPRGegh_1614157280) by smtp.aliyun-inc.com(127.0.0.1); Wed, 24 Feb 2021 17:01:21 +0800 Subject: Re: [PATCH v2 03/10] mm: don't pass "enum lru_list" to lru list addition functions To: Yu Zhao Cc: Andrew Morton , Matthew Wilcox , Vlastimil Babka , Hugh Dickins , Michal Hocko , Johannes Weiner , Vladimir Davydov , Roman Gushchin , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20210122220600.906146-1-yuzhao@google.com> <20210122220600.906146-4-yuzhao@google.com> <20210126220111.GO308988@casper.infradead.org> <20210223145011.0181eed96ab0091a493b51f6@linux-foundation.org> From: Alex Shi Message-ID: <1dd70f97-982f-f150-cd4b-592a220b1c82@linux.alibaba.com> Date: Wed, 24 Feb 2021 17:01:20 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.0; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 X-Stat-Signature: ni4mf1nye5wmqoyyj7urf9bwe6ijbyze X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 89A6EA0000FF Received-SPF: none (linux.alibaba.com>: No applicable sender policy available) receiver=imf15; identity=mailfrom; envelope-from=""; helo=out30-42.freemail.mail.aliyun.com; client-ip=115.124.30.42 X-HE-DKIM-Result: none/none X-HE-Tag: 1614157284-789898 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: =E5=9C=A8 2021/2/24 =E4=B8=8B=E5=8D=884:37, Yu Zhao =E5=86=99=E9=81=93: >>> @@ -65,18 +63,12 @@ static __always_inline void __clear_page_lru_flag= s(struct page *page) >>> */ >>> static __always_inline enum lru_list page_lru(struct page *page) >>> { >>> - enum lru_list lru; >>> + unsigned long flags =3D READ_ONCE(page->flags); >>> =20 >>> VM_BUG_ON_PAGE(PageActive(page) && PageUnevictable(page), page); >>> =20 >>> - if (PageUnevictable(page)) >>> - return LRU_UNEVICTABLE; >>> - >>> - lru =3D page_is_file_lru(page) ? LRU_INACTIVE_FILE : LRU_INACTIVE_A= NON; >>> - if (PageActive(page)) >>> - lru +=3D LRU_ACTIVE; >>> - >>> - return lru; >>> + return (flags & BIT(PG_unevictable)) ? LRU_UNEVICTABLE : >>> + (LRU_FILE * !(flags & BIT(PG_swapbacked)) + !!(flags & BIT(P= G_active))); >> Currently each of page flags used different flags policy, does this me= an above flags could be >> change to PF_ANY policy? > That's a good question. Semantically, no because > PG_{active,unevictable} only apply to head pages. But practically, > I think the answer is yes, and the only place that needs to > explicitly call compound_head() is gather_stats() in > fs/proc/task_mmu.c, IIRC. >=20 A quick testing for your testing request: # ll vmlinux vmlinux.new -rwxr-xr-x 1 root root 62245304 Feb 24 16:57 vmlinux -rwxr-xr-x 1 root root 62245280 Feb 24 16:55 vmlinux.new # gcc --version gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3) Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is N= O warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOS= E. # scripts/bloat-o-meter vmlinux vmlinux.new add/remove: 0/0 grow/shrink: 1/15 up/down: 1/-2008 (-2007) Function old new delta vermagic 37 38 +1 trace_event_raw_event_mm_lru_insertion 471 418 -53 perf_trace_mm_lru_insertion 526 473 -53 __munlock_pagevec 1134 1069 -65 isolate_migratepages_block 2623 2547 -76 isolate_lru_page 384 303 -81 __pagevec_lru_add 753 652 -101 release_pages 780 667 -113 __page_cache_release 429 276 -153 move_pages_to_lru 871 702 -169 lru_lazyfree_fn 712 539 -173 check_move_unevictable_pages 938 763 -175 __activate_page 665 488 -177 lru_deactivate_fn 636 452 -184 pagevec_move_tail_fn 597 411 -186 lru_deactivate_file_fn 1000 751 -249 Total: Before=3D17029652, After=3D17027645, chg -0.01%