Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp227790lqo; Tue, 7 May 2024 19:13:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX9p20Iws6+83OmjxYZzkJjvwXCXcjlSPD32L1SnEOi8KVuxB0IazThWvNxjoW99xhwRIqhJnG5kRw+WANAPDL44OuQhBiOM12G/U8A4Q== X-Google-Smtp-Source: AGHT+IG4CycT+Zw5fK7Gmcwh2UEwSTZNf0hzFsvRDBlV89VVi70wd8P0pWNAvjuS4Cm9Vkz8JUKp X-Received: by 2002:a17:902:a3cc:b0:1e4:6938:6fe3 with SMTP id d9443c01a7336-1eeb0b9aab3mr12912285ad.58.1715134419651; Tue, 07 May 2024 19:13:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715134419; cv=pass; d=google.com; s=arc-20160816; b=fnEhEpM+gwU6HIQKy478UaNzSpq785/y9hIsw3LXpNmuQPDSlFDqpOKVO9E+iqi1FR XeAgSsaduv4IhowJjmMW1NVXzQ8FwiZC9C06IOXvbiv/EWzVBwTwOvqDfTU5Rwv8tw5q JS+t3N7WM+4km4/5mWV2K3om97+FRxFZ1WGo14Ns/ptNcZN78cCqYhMLHVn1D+Of2RUi LdujEbA+xKd+UsRncvKdIc9YXxC9IgZkj1j+USbzJIqvDfriXwUIDIBRnmSibbFPs/JO yF/7IdUiSz5+wX1Q1QEKntWawCBGSkiRcNAq54Otzka3d9W+8BPBfSt96kPoP0yd5gJf OX5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id:dkim-signature; bh=PnVKvCgegzpzXY1p/Owa2fV8B2MMlLljlSzcXtnLj/4=; fh=vztUzzI7BW0j6J1Fd2p9764XyaeA0+RfI5+T4q/ohK0=; b=iwLiDxx5db0l6pYihw3UXml41A3YsWuQwRIKAEbjo6hv3NLj4PSxvTOU+qxl4x2jxm FsW5UEVanzdDHrvNxBksqKqQ1/Na/lJ7EyQCNeipAIF5pyWShOYudnGnUnOjacugAEW7 4f+vF6ZvgDQk6EDq+9NaursPkwH3UQ5dARuWgVHOHXrJxKcxvLjjykslJ83bTaIS81t2 kTwA7O5PD4S5idJWTob+cXnKSwVgGyAjXEPvN1ZRHi6/QJjaxbBWmuFkfL+klo9726AB tMJi+i7bn1W4BEd58tKMlIWuzVx6iSsm1HuajMPuEpOnS1hOolJkOQdjTGcd1w67fj7E 7uMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b="j/qiLOhh"; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-172621-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172621-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y3-20020a17090322c300b001eb52937c40si9352019plg.481.2024.05.07.19.13.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 19:13:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172621-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b="j/qiLOhh"; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-172621-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172621-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 49F76284796 for ; Wed, 8 May 2024 02:13:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A14CD944E; Wed, 8 May 2024 02:13:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="j/qiLOhh" Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E9499441 for ; Wed, 8 May 2024 02:13:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715134412; cv=none; b=jAPnoYsD4TR9fDMfAbQymlGJ1l38CUcJXi67LuXpdw6G0PORJIVE6ZhXn3SNR/Cf4QD8B8KZkFlX5O/6Jw+Zv+IobVBEfnI5H084GTCHrmSOYSWn8Y1lDeXNTaMxup5NjSzxuLN5fmfmDi5PejA3hFDbxPwfGI71hTmEuXr8cx8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715134412; c=relaxed/simple; bh=n5QFlSypq32hB2yeYcNZfKutq267CVYUJOO6/Fa/m+U=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=VtE3e6P6yuH2frVUDtF0BXqVyorBsXdFB83QCiG1JWAZDHuFfVYntQwfa2Fptt0BlP6cV+buiMLWyXrl/lV4WJruayJwlSqMJVLjccE1CTMGEo0byZl2yZLgkuUBBWU7ul/uyYjcFUxF2HPCyoI+y03kNgHOiuuZWnHtpKybHT8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=j/qiLOhh; arc=none smtp.client-ip=115.124.30.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1715134407; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=PnVKvCgegzpzXY1p/Owa2fV8B2MMlLljlSzcXtnLj/4=; b=j/qiLOhhXrhZ1kpndUmDgt3GewnErfft8O7iBC23+9/8Dg8Mgo765dhvpqKdANHbX9sZlWWe3SrvOPlmnO66iNn61lg2ovvO4kzVu6Ch2Uta73QvBTx54pqdTfcsHRcx8u+8VNXe4p7KFg636m+ebvRAiuYcwGeQVW4BrugROXk= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037067110;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0W61sxpy_1715134404; Received: from 30.97.56.69(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W61sxpy_1715134404) by smtp.aliyun-inc.com; Wed, 08 May 2024 10:13:25 +0800 Message-ID: <2fcd6dfc-21b7-4e3f-9741-8f0d23d2da5f@linux.alibaba.com> Date: Wed, 8 May 2024 10:13:23 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/8] mm: move highest_order() and next_order() out of the THP config To: Ryan Roberts , akpm@linux-foundation.org, hughd@google.com Cc: willy@infradead.org, david@redhat.com, ioworker0@gmail.com, wangkefeng.wang@huawei.com, ying.huang@intel.com, 21cnbao@gmail.com, shy828301@gmail.com, ziy@nvidia.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <9576c979-8a11-48e2-aec4-646acf0d8e26@arm.com> From: Baolin Wang In-Reply-To: <9576c979-8a11-48e2-aec4-646acf0d8e26@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/5/7 18:21, Ryan Roberts wrote: > On 06/05/2024 09:46, Baolin Wang wrote: >> Move highest_order() and next_order() out of the CONFIG_TRANSPARENT_HUGEPAGE >> macro, which can be common functions to be used. > > Sorry if I haven't kept up with the discussion, but why is this needed? I > wouldn't expect a need to iterate over orders if THP is compile-time disabled > because we will never try to allocate THP? Cause I don't want to add some dummy functions to avoid building errors if CONFIG_TRANSPARENT_HUGEPAGE is not enabled in patch 6. Another thought is that the pagecache can also allocate a large folio even when THP is not enabled, so these helpers may be used in the future (not sure though). Anyway, I also have no strong perference for this patch, below dummy functions can also work for me: diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index c15bebb2cf53..7aa802ee2ce5 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -586,6 +586,16 @@ static inline bool thp_migration_supported(void) { return false; } + +static inline int highest_order(unsigned long orders) +{ + return 0; +} + +static inline int next_order(unsigned long *orders, int prev) +{ + return 0; +} #endif /* CONFIG_TRANSPARENT_HUGEPAGE */