Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp380828lqo; Wed, 8 May 2024 02:40:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVpRmJXx+i71h7Z2c2o0U4wmAGEc6fDULvq7gmCOI2NqEC9vmF7Q+KMq0VBkSHFSdOWKUurzo3Kwj6HXWs6K4bCkv8dTl7AC4qJMmQ5+Q== X-Google-Smtp-Source: AGHT+IHXNP4BUQq/XaSTJxb+716ykl/k/+UZuCy/3lJixgvBv43EHhhWGXiW+7r/NOe3oIeznBd+ X-Received: by 2002:a05:6a20:6a2a:b0:1ac:3b5d:a3eb with SMTP id adf61e73a8af0-1afc8db5c43mr2669015637.39.1715161242468; Wed, 08 May 2024 02:40:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715161242; cv=pass; d=google.com; s=arc-20160816; b=L0iVibnzr+/nynW/k1/lO2ku545hsXVTYrapwhnGYoN3i8o2nZgn0zo1kPaYEwV6Ua e8ju6xsTkbIDMySdaWDPEHBq2MUS8GV9rR3jcmW9jRi8pLiLDxx5iTscW4uGfhIuHEEn t2/hx16ADH/uzReCI7lfiUa5ClAteUI1aM1wHoXTn9CPHfkmwDAiwGApDRCm2svopIdu VveTvWooYbMoJ/R6ztLh6g2R/GKfe2TlyEODJhy0E6LMDx8rjoOzDCOFoYSgW6CGXbAL gMmhTSPALn/NwOM5X2O4XDMiTA8TFJ+DUWJD2vQXAqNZF7WJh4drnSEqHoZHerlxxK4b bG1A== 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=7PolV6oZOy6l4rky9sVZcKOydBFtU8Dw4oGyzGtNEmk=; fh=vztUzzI7BW0j6J1Fd2p9764XyaeA0+RfI5+T4q/ohK0=; b=UjKcUcPNRTr1rwO3WWlDbC1glrotwvCxZzdQfmocsgc+0HN8bjfYWEiBSL7il6ZSwZ agcbRptMoPVTFkG+5oRHCk09+haPB8pkGsIgnWzt5F8/xSXIaB6cjNF2iyQ0Skw8Nypo gdjQgHwQQFGW1oCiiPbjYH41Hf48ePKOwuNTspTx545VDr8xx03kLZIvRl6XqvL4slw2 /yZ//x5aMcE90CcyKcAPGvFTTxDWBkWA7firmW4tnwdeVmzGKvCVb66F5+M6YeP+5sVE cBliT0zIIbFX/64+2Iw48YMr6S3K2pHMEA8q2je8mD7mNHV5Pqv8qGljQtOAqVixEQJv 4E+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b="XJ1/7aSq"; 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-172977-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172977-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 i193-20020a639dca000000b0061574ba03d6si12622378pgd.419.2024.05.08.02.40.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 02:40:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172977-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="XJ1/7aSq"; 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-172977-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172977-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 E67F928422E for ; Wed, 8 May 2024 09:40:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B5B677F15; Wed, 8 May 2024 09:40:30 +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="XJ1/7aSq" Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) (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 C38001DFE8 for ; Wed, 8 May 2024 09:40:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.132 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715161228; cv=none; b=JKRFjH9GF6oQ3+H84oOxvYkV8+Wc59XmBamhWV2JRW0oGf4YJxROvHZpG1wFacGNaIIQwykROE6l+I2/BzdKoyRI1cFGk0+Pv7VJtNjKpN6Ujayweell5cYPo13+nHFeUXJ9ign7izPeE0B2nT+GBxiJ6eg9w+PQi4wzNYSIZW8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715161228; c=relaxed/simple; bh=89fF2WUvzEs/BGabOMYifyRgGUfmVocWR9VpboGPG6w=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hCgSzpQUGb7S9v5DEwU054JHkKU9NsPcQ7rD5hxFa+ey2i265tO1aIdgZKg5ktGB7Er/59iijZJ/igw6aEFiZqjZG7UF/ogBXZBmsY4UFw8DovxQYIll5mtchRrJFuOAiMAC2y5ST1yK+qLAwCTDm1ckdrQdz10hRooqJcupG4k= 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=XJ1/7aSq; arc=none smtp.client-ip=115.124.30.132 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=1715161222; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=7PolV6oZOy6l4rky9sVZcKOydBFtU8Dw4oGyzGtNEmk=; b=XJ1/7aSqVuFwfQRJ7CXhJ0/NvSX/Hd4MNkMf5DGn63YxLjFIDpVSp9kA4RtsRZY0JSEzfYsgaYEWC4dv3jPOAuKueDzzuEa13KiruigaWIbomcZLTzjzEkulq90FA2bTcNcekBZkgHX4kf/nlv5yrx+kyott16Ae9UCJpRUg0D4= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033022160150;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0W63EItG_1715161219; Received: from 30.97.56.69(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W63EItG_1715161219) by smtp.aliyun-inc.com; Wed, 08 May 2024 17:40:21 +0800 Message-ID: Date: Wed, 8 May 2024 17:40:19 +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> <2fcd6dfc-21b7-4e3f-9741-8f0d23d2da5f@linux.alibaba.com> From: Baolin Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/5/8 17:06, Ryan Roberts wrote: > On 08/05/2024 03:13, Baolin Wang wrote: >> >> >> 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). > > OK, I'll admit I haven't looked at the latter patches yet - I'd like to conclude > on the interface and mapping/alignment strategy first. > > But it wasn't necessary to access these functions for the anon/private case > without CONFIG_TRANSPARENT_HUGEPAGE, so I'm wondering why it's needed for shmem > case. I would expect that they don't need to be defined at all. Currently in the shmem_alloc_and_add_folio() function, the hugepage allocating is not guarded with '#ifdef CONFIG_TRANSPARENT_HUGEPAGE', but rather with 'IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)', which can lead to some building errors when CONFIG_TRANSPARENT_HUGEPAGE is not enabled. However, this is not a big issue, and I will make some adjustments to avoid defining dummy functions.