Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1489066ybt; Thu, 9 Jul 2020 08:14:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4Kcfzy9kxS2uy+rKSAhjTLJ1C9vwX4MWNzLJD+fPrCi82Xkoj2JXwozbgMpNgtsEXEkql X-Received: by 2002:aa7:cf82:: with SMTP id z2mr55505208edx.15.1594307672061; Thu, 09 Jul 2020 08:14:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594307672; cv=none; d=google.com; s=arc-20160816; b=qECtgiNbi5AI9MScwb4caY5/p1cg9lrDUPJQh9qli8N5W3P98ehfcrNZUeZHeIl+9r zgqgTmtCVigsX0Dsr+qgAewlidbtduQNxn37utZTJtN8Zxv8VPQaH2eHuIMmtee4t2c3 rZTrjqM7FZUcmPeqAGWCai5dk2/oNSNSmAWRBxPMHQuSDesfFeu5ZhgmqG8j4NfQk4Ss fadlHU1PgMufu2AR7Zs878o9arUReC+dnPT8dZaly2BPApmvtsXQVdELFCWGeRqjs2ym 2KTb69/H+IenLYLCc5/mhnhEur/Fk3C9LfNmKUNeRdSt21cyUwqOV26CS5BvBnRIachB 0q7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:date:message-id:subject:from:to; bh=CC1MWKqfDwii5xp1yAHLU8jyS7M+tMzpg3Etai5wWgc=; b=zPERFc+QUbJu/zVsiKFn5RVdbg8668JdQWYKea7P8U1uKEpmpPSSzsQYUw44MCThEH C1fHTmRo3njD6YOJvrAtuvPUiSNEyEIzkUymQ7z39ZqOG803xk/9T+BlUR0XRg5TjzS4 rHkqyyM/zpDrBH11OkOpgCFDd7em9YWkyjru+3AYIp9adCeWdWsWx3TJvkq9/z+yvyCt wlq48NMkWZH5lVeZ2diutEKrF7l8iQKjl77C0S9UNvf4UFBYu8QoVHmEgfNa6yW3yo4X L5TtDON0jZ9k70OcieCofwmcNVrqq0fI3vdM67ajw0oYa5REV+EpgYvHsaHjD7ic89ly awoA== 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 v15si2417636edl.205.2020.07.09.08.14.06; Thu, 09 Jul 2020 08:14:32 -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 S1726832AbgGIPLy (ORCPT + 99 others); Thu, 9 Jul 2020 11:11:54 -0400 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:44696 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726410AbgGIPLy (ORCPT ); Thu, 9 Jul 2020 11:11:54 -0400 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 }