Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp335366pxb; Thu, 5 Nov 2020 01:01:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJycDNjY5/NYwRXWfl8J1F3YFEzkiJzGY9qvKCZbFgIMeUaRvCthGi4IhDGJToPK9mQID90d X-Received: by 2002:a50:b746:: with SMTP id g64mr1559511ede.380.1604566865142; Thu, 05 Nov 2020 01:01:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604566865; cv=none; d=google.com; s=arc-20160816; b=j+qMIHIn3SlG8TVcuk0ZT+x+T1auyWuTD+DdhdKpgfYrcZBABp8TD5AwGie1JEeoWH wvmLcaqrMCJey2a19xAtpXZ6j4V86LpacTGaNV2tILi77OT5sS3uJjTvIyj9oZj02ZAu r9CXIHN/h3HRR78oAG3B3JnP7IWknJmJlSvOS5FHW+rXcqYkzJwOX4/kahfOsGp0Mz9+ Ao/GYEkmFgy48uHr1uJRSwEuGVYwPy4RIlIBZXyQEG7sGb+4tQsTqZrnVtE0OVnOqjsh XUz3dou5wcHLBuFsO9+y0UibU7JmbLR04V2Q8HvdHAiYGE26mbHO79oR4NRH3xKX9B1J jsDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :to:from; bh=LIAqSz4Px2pRVWPph9NTjY+jQ2tnEzGTd3HerSyZ9xk=; b=vpndfwMDmmfj+cWZeRXu7K25bh3GRsvEkFsUB2Gq1IgC5Sd+5b3Yq9ANTvv9RymaS6 M75uBZM9WTY2GwDwcIcnKYXYsJOdmNvMGFAIi5ghq2GfSyYCnOlZbSM2p5+k9F6M/Bf9 l4IGDmeFvHlwjqOjc/h6oQyGK8KRY4aUdYWgytafIiF2V16PR6C7wC59ebYL5FkgKscx H6xuYHGI+64Qv/tf5VjJBbSAkaBJO93DYI90iwsJCzYYhehA6Ha7YDnz3wrDoaRjanxZ W43qZSUlHgabko5AB1wjOgHs+crBG9NqD3yuTtFuK2vcMJV8FP/nnDad7of71pNWAPd0 79lg== 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 o17si744171ejg.500.2020.11.05.01.00.42; Thu, 05 Nov 2020 01:01:05 -0800 (PST) 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 S1730386AbgKEI4Q (ORCPT + 99 others); Thu, 5 Nov 2020 03:56:16 -0500 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:57004 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726428AbgKEI4O (ORCPT ); Thu, 5 Nov 2020 03:56:14 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=21;SR=0;TI=SMTPD_---0UEJC3Fv_1604566567; Received: from aliy80.localdomain(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0UEJC3Fv_1604566567) by smtp.aliyun-inc.com(127.0.0.1); Thu, 05 Nov 2020 16:56:08 +0800 From: Alex Shi To: 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, hannes@cmpxchg.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 Subject: [PATCH v21 02/19] mm/thp: use head for head page in lru_add_page_tail Date: Thu, 5 Nov 2020 16:55:32 +0800 Message-Id: <1604566549-62481-3-git-send-email-alex.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604566549-62481-1-git-send-email-alex.shi@linux.alibaba.com> References: <1604566549-62481-1-git-send-email-alex.shi@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Matthew Wilcox (Oracle) Acked-by: Hugh Dickins Acked-by: Johannes Weiner 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 8f16e991f7cc..60726eb26840 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2348,33 +2348,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