Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp947943pxx; Thu, 29 Oct 2020 19:50:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx31i0pzUh1YGbuHMmPh/lxvo4J3URmsKrnFQtCfqUGpazJ80cj04sZGe1Wmj+FZOCqjyVV X-Received: by 2002:a17:906:1989:: with SMTP id g9mr398411ejd.62.1604026246933; Thu, 29 Oct 2020 19:50:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604026246; cv=none; d=google.com; s=arc-20160816; b=QEsJPknlWYPCEVjbNouFoFQSlQwlH08eK9/x7pmbMOpGWopmmvEIDlR4/SApoHdpXY D296O4W0u+0wlx1jkbSGul9Q8ubEq3JijAmkrfSKdOC/iBfGWss8ShR2VFqCmsQ4/3wc 5sdw/c4f9AdzaTKIZH4bEyzHda03rjSB6+FRwzGoDYsFchkzTFWGneGsBsfm0FZDM4r2 hMMsc77GbUJ/PGmepLe8s5nbewdkEnKWoqLxgOM0Bho/5HaH7QyBIFO01+mpS/V6+NBe HAnLvjcZ1o/KhO3arY+VArSGCEmPVNPkBJaQvJCeUXey71FsLFV6d2QDpOc2E+kb5tBP sJyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=OkzEGfO2QMQOn4NcVD0HkQ5xB7AAbpxBTOYWBzyMQbw=; b=giih9f/L96S+FLtLnb2z1jhEN41Q/tzuE4OqfPkMFRiSxrZeGxwSemWS8CodWvZXfX VIaMEY2C6lHEovv5MOtH2Mb+XIzV3q2UD61asabbx3owDvNK2Vw5xVXH6IcORJ+/n11m b+4qHqQAf0y7qledUWiPA8HOhH03ryfuYGDXoHWR7OhBA++txIshcoDSHF+3HROR2q2V hkJqs2Z4KL5JHXqXsosM0H7kxmQMeuQZY/1oqiXFvSfZI1GlI1NHOKb6VpkcXhmKP5Ue PCyHK5WB91kYTWTQbtVwFsC6AUHUZGkN3zALXcAoM6WG5XuqJ927eU7p48vkdV7hx5PR ZKVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a6si3203515ejd.276.2020.10.29.19.50.24; Thu, 29 Oct 2020 19:50:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725961AbgJ3CtG (ORCPT + 99 others); Thu, 29 Oct 2020 22:49:06 -0400 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:43121 "EHLO out30-44.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725797AbgJ3CtF (ORCPT ); Thu, 29 Oct 2020 22:49:05 -0400 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: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ?? 2020/10/29 ????9:50, Johannes Weiner ะด??: > 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 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 | 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, unsigned int nr) >> } >> } >> >> -static void lru_add_page_tail(struct page *page, struct page *page_tail, >> +static void lru_add_page_tail(struct page *head, struct page *page_tail, > > 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 parameters I will change to use head/tail too. And then, the 04th, 05th, and 18th patch will be changed accordingly. Thanks Alex > or > page_head and page_tail > > ? > 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, unsigned int nr) } } -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); if (!list) - SetPageLRU(page_tail); + SetPageLRU(tail); - 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)); } } -- 1.8.3.1