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=-11.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, 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 6599DC4363A for ; Fri, 30 Oct 2020 02:49:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B2165206ED for ; Fri, 30 Oct 2020 02:49:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B2165206ED 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 D9E306B005D; Thu, 29 Oct 2020 22:49:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D26186B006C; Thu, 29 Oct 2020 22:49:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC7636B006E; Thu, 29 Oct 2020 22:49:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0043.hostedemail.com [216.40.44.43]) by kanga.kvack.org (Postfix) with ESMTP id 8BF756B005D for ; Thu, 29 Oct 2020 22:49:17 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 3783A180AD80F for ; Fri, 30 Oct 2020 02:49:17 +0000 (UTC) X-FDA: 77427060354.20.title73_341837f27292 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 1C289180C07A3 for ; Fri, 30 Oct 2020 02:49:17 +0000 (UTC) X-HE-Tag: title73_341837f27292 X-Filterd-Recvd-Size: 5749 Received: from out4436.biz.mail.alibaba.com (out4436.biz.mail.alibaba.com [47.88.44.36]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Fri, 30 Oct 2020 02:49:15 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R221e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04420;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=21;SR=0;TI=SMTPD_---0UDb1Q6i_1604026140; Received: from IT-FVFX43SYHV2H.local(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0UDb1Q6i_1604026140) by smtp.aliyun-inc.com(127.0.0.1); Fri, 30 Oct 2020 10:49:01 +0800 Subject: Re: [PATCH v20 04/20] mm/thp: use head for head page in lru_add_page_tail To: Johannes Weiner Cc: akpm@linux-foundation.org, mgorman@techsingularity.net, tj@kernel.org, hughd@google.com, khlebnikov@yandex-team.ru, daniel.m.jordan@oracle.com, willy@infradead.org, lkp@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, shakeelb@google.com, iamjoonsoo.kim@lge.com, richard.weiyang@gmail.com, kirill@shutemov.name, alexander.duyck@gmail.com, rong.a.chen@intel.com, mhocko@suse.com, vdavydov.dev@gmail.com, shy828301@gmail.com References: <1603968305-8026-1-git-send-email-alex.shi@linux.alibaba.com> <1603968305-8026-5-git-send-email-alex.shi@linux.alibaba.com> <20201029135047.GE599825@cmpxchg.org> From: Alex Shi Message-ID: <06a5b7d8-bbf2-51b7-1352-2b630186e15f@linux.alibaba.com> Date: Fri, 30 Oct 2020 10:46:54 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20201029135047.GE599825@cmpxchg.org> Content-Type: text/plain; charset=gbk 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: =D4=DA 2020/10/29 =CF=C2=CE=E79:50, Johannes Weiner =D0=B4=B5=C0: > On Thu, Oct 29, 2020 at 06:44:49PM +0800, Alex Shi wrote: >> Since the first parameter is only used by head page, it's better to ma= ke >> it explicit. >> >> Signed-off-by: Alex Shi >> Reviewed-by: Kirill A. Shutemov >> Acked-by: Hugh Dickins >> Cc: Andrew Morton >> Cc: Johannes Weiner >> Cc: Matthew Wilcox >> Cc: Hugh Dickins >> Cc: linux-mm@kvack.org >> Cc: linux-kernel@vger.kernel.org >> --- >> mm/huge_memory.c | 12 ++++++------ >> 1 file changed, 6 insertions(+), 6 deletions(-) >> >> diff --git a/mm/huge_memory.c b/mm/huge_memory.c >> index 038db815ebba..93c0b73eb8c6 100644 >> --- a/mm/huge_memory.c >> +++ b/mm/huge_memory.c >> @@ -2346,19 +2346,19 @@ static void remap_page(struct page *page, unsi= gned int nr) >> } >> } >> =20 >> -static void lru_add_page_tail(struct page *page, struct page *page_ta= il, >> +static void lru_add_page_tail(struct page *head, struct page *page_ta= il, >=20 > It may be better to pick either > head and tail Hi Johannes, Thanks for comments! Right, Consider functions in this file are using head/tail more as parame= ters I will change to use head/tail too. And then, the 04th, 05th, and 18th pa= tch=20 will be changed accordingly. Thanks Alex > or > page_head and page_tail >=20 > ? >=20 >From a9ee63a213f40eb4d5a69b52fbb348ff9cd7cf6c Mon Sep 17 00:00:00 2001 From: Alex Shi Date: Tue, 26 May 2020 16:49:22 +0800 Subject: [PATCH v21 04/20] mm/thp: use head for head page in lru_add_page= _tail Since the first parameter is only used by head page, it's better to make it explicit. Signed-off-by: Alex Shi Reviewed-by: Kirill A. Shutemov Acked-by: Hugh Dickins Cc: Andrew Morton Cc: Johannes Weiner Cc: Matthew Wilcox Cc: Hugh Dickins Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/huge_memory.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 038db815ebba..32a4bf5b80c8 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2346,33 +2346,32 @@ static void remap_page(struct page *page, unsigne= d int nr) } } =20 -static void lru_add_page_tail(struct page *page, struct page *page_tail, +static void lru_add_page_tail(struct page *head, struct page *tail, struct lruvec *lruvec, struct list_head *list) { - VM_BUG_ON_PAGE(!PageHead(page), page); - VM_BUG_ON_PAGE(PageCompound(page_tail), page); - VM_BUG_ON_PAGE(PageLRU(page_tail), page); + VM_BUG_ON_PAGE(!PageHead(head), head); + VM_BUG_ON_PAGE(PageCompound(tail), head); + VM_BUG_ON_PAGE(PageLRU(tail), head); lockdep_assert_held(&lruvec_pgdat(lruvec)->lru_lock); =20 if (!list) - SetPageLRU(page_tail); + SetPageLRU(tail); =20 - if (likely(PageLRU(page))) - list_add_tail(&page_tail->lru, &page->lru); + if (likely(PageLRU(head))) + list_add_tail(&tail->lru, &head->lru); else if (list) { /* page reclaim is reclaiming a huge page */ - get_page(page_tail); - list_add_tail(&page_tail->lru, list); + get_page(tail); + list_add_tail(&tail->lru, list); } else { /* * Head page has not yet been counted, as an hpage, * so we must account for each subpage individually. * - * Put page_tail on the list at the correct position + * Put tail on the list at the correct position * so they all end up in order. */ - add_page_to_lru_list_tail(page_tail, lruvec, - page_lru(page_tail)); + add_page_to_lru_list_tail(tail, lruvec, page_lru(tail)); } } =20 --=20 1.8.3.1