Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1763472rdh; Tue, 26 Sep 2023 02:53:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGuOZcm6vH4LGa7UnzB8iMRcTx0Z8TE5/c4OwISdMtvn7ct5qVDXn42UzOHPFS3cSJ7Tzia X-Received: by 2002:a05:6a00:997:b0:691:2d4:2389 with SMTP id u23-20020a056a00099700b0069102d42389mr8574543pfg.21.1695722024607; Tue, 26 Sep 2023 02:53:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695722024; cv=none; d=google.com; s=arc-20160816; b=prYmOkBWWrw/ocqTB5kUski/EiawhLSK/oxCn4gF1qD+1DrdeZU+Z3H5vd/T55hl4Q Z5S8cKj5EPbSXWvYOv/bKY6xT7Haz6DqhdX86bR2uN3NKmI+8SxnR6mPbiehmnrb1axv Lp/FVKFn/OCvFrWi+0iMAS378TUokCEQ5RwErWQKGcG2Z7ruTJaQWV5x1MJZyQT2/8jM QGD8EP9v+Pqymy9Mv7runTnt3yT4XRUXQN5IrZn2PMsfmH4mKZzDhIShkKKkAVhUr/xh I5ZGPspiWezKDEw4xEbXpy63oF+9WBzgSsTNGfZ3uRz8pu4LCTpWVP6Y6jicaj9xD26Y kTcA== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=9swnQWzLHDffhyoJjL10IEmX7M9RtOBZg6MpE1D5NFY=; fh=rNibc3UBpeuG+5pZ7HaqM8PZWzPFtrBthTORknjZE00=; b=kiQbW91NNWcYAxBc++67I0ChwevP8hmFl1UzJ3hPn2AMgLEPvRg2E0EJA7KfUhNXlF 5JYV4kVAhqqCyse6bfnkfI1S0o/ZmrLj1phJznFtaj76EE70llIz8kk0QSDYSyptSy/F e1gqdhkr/fpoZ0Wq9O7d+y7niG/M5eL303io2xMlHyI0ZYu30wCBxHqk77f3oJjGRJD8 KpGyEwObV/vNehvZvEzW0B/l2BnZrWqcfw4w8QSLksr/lmSJTklYVcFVttANxRRruZQJ kaJRw4O5SjEUhor9YyK3e7Rso2SBwXW28eenY/2S8v7nF7HiFsxfLihUBb8qdL8BvHBs mfQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id g22-20020a056a0023d600b0068e35157c26si12667488pfc.310.2023.09.26.02.53.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 02:53:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 227E2828950C; Tue, 26 Sep 2023 02:39:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234313AbjIZJjr (ORCPT + 99 others); Tue, 26 Sep 2023 05:39:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234335AbjIZJjg (ORCPT ); Tue, 26 Sep 2023 05:39:36 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D32810C for ; Tue, 26 Sep 2023 02:39:26 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Rvvlp1sNyzrT6n; Tue, 26 Sep 2023 17:37:10 +0800 (CST) Received: from [10.174.177.243] (10.174.177.243) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 26 Sep 2023 17:39:24 +0800 Message-ID: <75d28233-c8bd-4528-a775-8ccdc7fc3e26@huawei.com> Date: Tue, 26 Sep 2023 17:39:23 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH -next 8/9] mm: page_alloc: use a folio in free_pages_prepare() Content-Language: en-US To: David Hildenbrand , Andrew Morton CC: Mike Rapoport , Matthew Wilcox , , , , Zi Yan References: <20230926005254.2861577-1-wangkefeng.wang@huawei.com> <20230926005254.2861577-9-wangkefeng.wang@huawei.com> From: Kefeng Wang In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 26 Sep 2023 02:39:49 -0700 (PDT) On 2023/9/26 15:49, David Hildenbrand wrote: > On 26.09.23 02:52, Kefeng Wang wrote: >> The page should not a tail page in free_pages_prepare(), let's use >> a folio in free_pages_prepare() to save several compound_head() calls. >> >> Signed-off-by: Kefeng Wang >> --- >>   mm/page_alloc.c | 15 ++++++++------- >>   1 file changed, 8 insertions(+), 7 deletions(-) >> >> diff --git a/mm/page_alloc.c b/mm/page_alloc.c >> index 06be8821d833..a888b9d57751 100644 >> --- a/mm/page_alloc.c >> +++ b/mm/page_alloc.c >> @@ -1070,6 +1070,7 @@ static __always_inline bool >> free_pages_prepare(struct page *page, >>               unsigned int order, fpi_t fpi_flags) >>   { >>       int bad = 0; >> +    struct folio *folio = page_folio(page); > > We might have higher-order pages here that are not folios (not compound > pages). It looks a bit like this function really shouldn't be working > with folios in the generic way, for that reason. > > Wrong level of abstraction in that function. Thanks for your point this, also the change also looks unnecessary too, the main purpose to use a folio in this function is prepared for converting page_cpupid_reset_last() to folio, as the higher-order pages the next patch is not right, I will reconsider it. > > What am I missing? >