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 19EDCC433E0 for ; Thu, 9 Jul 2020 15:12:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AD969206C3 for ; Thu, 9 Jul 2020 15:12:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD969206C3 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 21B276B0003; Thu, 9 Jul 2020 11:12:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CBFF6B0008; Thu, 9 Jul 2020 11:12:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 108366B000A; Thu, 9 Jul 2020 11:12:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0112.hostedemail.com [216.40.44.112]) by kanga.kvack.org (Postfix) with ESMTP id EF1116B0003 for ; Thu, 9 Jul 2020 11:12:33 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A753A3CF6 for ; Thu, 9 Jul 2020 15:12:33 +0000 (UTC) X-FDA: 77018878986.18.lace74_410648b26ec6 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id 7123A100ED3C5 for ; Thu, 9 Jul 2020 15:12:33 +0000 (UTC) X-HE-Tag: lace74_410648b26ec6 X-Filterd-Recvd-Size: 2862 Received: from out4436.biz.mail.alibaba.com (out4436.biz.mail.alibaba.com [47.88.44.36]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Thu, 9 Jul 2020 15:12:32 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04407;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0U2DJH.9_1594307508; Received: from IT-FVFX43SYHV2H.lan(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0U2DJH.9_1594307508) by smtp.aliyun-inc.com(127.0.0.1); Thu, 09 Jul 2020 23:11:49 +0800 To: Johannes Weiner , "Kirill A. Shutemov" , Matthew Wilcox , Linux-MM , "linux-kernel@vger.kernel.org" , Hugh Dickins From: Alex Shi Subject: a question of split_huge_page Message-ID: Date: Thu, 9 Jul 2020 23:11: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 Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 7123A100ED3C5 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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: Hi Kirill & Matthew, In the func call chain, from split_huge_page() to lru_add_page_tail(), Seems tail pages are added to lru list at line 963, but in this scenario the head page has no lru bit and isn't set the bit later. Why we do this? or do I miss sth? Many Thanks Alex 938 void lru_add_page_tail(struct page *page, struct page *page_tail, 939 struct lruvec *lruvec, struct list_head *list) 940 { 941 VM_BUG_ON_PAGE(!PageHead(page), page); 942 VM_BUG_ON_PAGE(PageCompound(page_tail), page); 943 VM_BUG_ON_PAGE(PageLRU(page_tail), page); 944 lockdep_assert_held(&lruvec_pgdat(lruvec)->lru_lock); 945 946 if (!list) 947 SetPageLRU(page_tail); 948 949 if (likely(PageLRU(page))) 950 list_add_tail(&page_tail->lru, &page->lru); 951 else if (list) { 952 /* page reclaim is reclaiming a huge page */ 953 get_page(page_tail); 954 list_add_tail(&page_tail->lru, list); 955 } else { 956 /* 957 * Head page has not yet been counted, as an hpage, 958 * so we must account for each subpage individually. 959 * 960 * Put page_tail on the list at the correct position 961 * so they all end up in order. 962 */ 963 add_page_to_lru_list_tail(page_tail, lruvec, 964 page_lru(page_tail)); 965 } 966 }