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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=no 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 A848AC433DF for ; Tue, 7 Jul 2020 12:00:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 73A3D206BE for ; Tue, 7 Jul 2020 12:00:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 73A3D206BE 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 0F7406B0022; Tue, 7 Jul 2020 08:00:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0A8CB8D001D; Tue, 7 Jul 2020 08:00:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EB3106B0024; Tue, 7 Jul 2020 08:00:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0250.hostedemail.com [216.40.44.250]) by kanga.kvack.org (Postfix) with ESMTP id D6FC36B0022 for ; Tue, 7 Jul 2020 08:00:52 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 941E01EF3 for ; Tue, 7 Jul 2020 12:00:52 +0000 (UTC) X-FDA: 77011138344.17.elbow18_280c1d926eb4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id A9C36180D0185 for ; Tue, 7 Jul 2020 12:00:49 +0000 (UTC) X-HE-Tag: elbow18_280c1d926eb4 X-Filterd-Recvd-Size: 2991 Received: from out30-42.freemail.mail.aliyun.com (out30-42.freemail.mail.aliyun.com [115.124.30.42]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Jul 2020 12:00:48 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07484;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---0U20KAQo_1594123241; Received: from IT-FVFX43SYHV2H.local(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0U20KAQo_1594123241) by smtp.aliyun-inc.com(127.0.0.1); Tue, 07 Jul 2020 20:00:42 +0800 Subject: Re: [PATCH v15 05/21] mm/thp: move lru_add_page_tail func to huge_memory.c To: akpm@linux-foundation.org, mgorman@techsingularity.net, tj@kernel.org, hughd@google.com, khlebnikov@yandex-team.ru, daniel.m.jordan@oracle.com, yang.shi@linux.alibaba.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 A. Shutemov" References: <1594122412-28057-1-git-send-email-alex.shi@linux.alibaba.com> <1594122412-28057-6-git-send-email-alex.shi@linux.alibaba.com> From: Alex Shi Message-ID: <9fa2cf92-c4a0-02ca-1f02-7ef71952de18@linux.alibaba.com> Date: Tue, 7 Jul 2020 20:00:11 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <1594122412-28057-6-git-send-email-alex.shi@linux.alibaba.com> Content-Type: text/plain; charset=gbk X-Rspamd-Queue-Id: A9C36180D0185 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: =D4=DA 2020/7/7 =CF=C2=CE=E77:46, Alex Shi =D0=B4=B5=C0: > =20 > +static void lru_add_page_tail(struct page *page, struct page *page_tai= l, > + 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); > + lockdep_assert_held(&lruvec_pgdat(lruvec)->lru_lock); > + > + if (!list) > + SetPageLRU(page_tail); > + > + if (likely(PageLRU(page))) > + list_add_tail(&page_tail->lru, &page->lru); > + else if (list) { > + /* page reclaim is reclaiming a huge page */ > + get_page(page_tail); > + list_add_tail(&page_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 > + * so they all end up in order. > + */ > + add_page_to_lru_list_tail(page_tail, lruvec, > + page_lru(page_tail)); I missed some points for this function, since in the call chain: split_huge_page() to lru_add_page_tail, the head page's lru won't be set when !PageLRU(head). But the other page_tail are add to lru list here Is it ok for this situation? Thanks! Alex > + } > +}