Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2519799rdh; Wed, 27 Sep 2023 05:20:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGO+BMqcsNSMf4sd7ZRSizP4vKqPCEcvh5bTxsvCk2R8MeqCqTJEn3OxQJFH6lJDM8a3dI5 X-Received: by 2002:a05:6870:20b:b0:1bf:4f42:de91 with SMTP id j11-20020a056870020b00b001bf4f42de91mr2314974oad.33.1695817254607; Wed, 27 Sep 2023 05:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695817254; cv=none; d=google.com; s=arc-20160816; b=xPpdmMCzoRkQI/tWgbvMwOz/NM2V64FOpqKcI5Y5wqSsPxukhTKdlrWL5wnRsmXOUZ Ffqa4piMQ0LCEhGhRJFDV41YASXHnn7K1JAdmkFz/fs0D3r/QKc7o7YYU0hGolf0HlOO XCs7yQEICwMBbceTU3SOlTtIffLZmOcoA0cTF/PiyqMLwuh3vscIPZr3VfSadIlAewzp qkxO+lLddsP0UWkG/QPV2rzMorjqWwsYDiJgKspod88/xAlVTiYLd4I8uDCOA4ceBXFt vRezhl/cAjPycziF3DpC6Roj9xOFPiCsth+Z4fnHK4B9UOiNQdAuPKmfYH5wBizqWJW7 loOw== 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:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id; bh=1hM6Jc5/6JswsKzqpUZig6UwN7mM1opO81OUti4vJEM=; fh=rNibc3UBpeuG+5pZ7HaqM8PZWzPFtrBthTORknjZE00=; b=Kwkei16wGGjtWTXEJ7WTyNz4odeT77GgvswSmNJ+vU1dZltb8escQYo1BHBPEGqSE1 gjQ+5QZERDH1TT2A4vr07tUqHDjN37YhjYjFfjUryS+KOXGCL8YluMt3FK1NfiX2gHvj vOjht/KhV41/nqwABGEe+AXhmQS3Ja939Szhr4ZD90w7HQa/OuLWl7CiTFYhO1f/yybv 5oZGC1Dddi7UdYaSjhCHij4i4bCiqKBHV65CsXS/3WaS6n98iYmHOwwNAEBObl0s937m wdiYN96vkvnQFOOLEghZ9P6LJ7KCODUXq1r2/WynD6m3n2No5O/GelNxY1uvjiVfFT3/ eMbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id n13-20020a65488d000000b00578c64433c9si15964431pgs.894.2023.09.27.05.20.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 05:20:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 8746780F9BC1; Wed, 27 Sep 2023 05:08:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231334AbjI0MIb (ORCPT + 99 others); Wed, 27 Sep 2023 08:08:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229901AbjI0MIb (ORCPT ); Wed, 27 Sep 2023 08:08:31 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3C9CBE for ; Wed, 27 Sep 2023 05:08:28 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Rwb1F64NszrT7R; Wed, 27 Sep 2023 20:06:09 +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; Wed, 27 Sep 2023 20:08:25 +0800 Message-ID: Date: Wed, 27 Sep 2023 20:08:24 +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 From: Kefeng Wang 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> <75d28233-c8bd-4528-a775-8ccdc7fc3e26@huawei.com> In-Reply-To: <75d28233-c8bd-4528-a775-8ccdc7fc3e26@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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 morse.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 (morse.vger.email [0.0.0.0]); Wed, 27 Sep 2023 05:08:40 -0700 (PDT) Hi David and all, On 2023/9/26 17:39, Kefeng Wang wrote: > > > 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. > As David mentioned,free_pages_prepare should not use folio, I won't to convert page_cpupid_reset_last(), that is, only the first 7 patches are reserved, any comments about the above patches, many thanks.