From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A2BBC30653 for ; Thu, 4 Jul 2024 14:46:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 60CC66B0088; Thu, 4 Jul 2024 10:46:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5BBE16B008A; Thu, 4 Jul 2024 10:46:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45CFF6B0093; Thu, 4 Jul 2024 10:46:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 276626B0088 for ; Thu, 4 Jul 2024 10:46:44 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id AD75C160865 for ; Thu, 4 Jul 2024 14:46:43 +0000 (UTC) X-FDA: 82302346686.30.99E3F33 Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by imf22.hostedemail.com (Postfix) with ESMTP id C98A8C0013 for ; Thu, 4 Jul 2024 14:46:41 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=kt2WNqIN; spf=pass (imf22.hostedemail.com: domain of libang.linux@gmail.com designates 209.85.166.65 as permitted sender) smtp.mailfrom=libang.linux@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720104377; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ovAGVS3VHRPu/ayJ7OgBZYBcLdsO3egzdp3KRf/I5wo=; b=Jvp732RB9HVmXkvLpnHxGfu3BFETUCHIvgQRxQI8kI19Pe128fRenizwou0bh4Z1mTESQj pA6HVU1u+M33y7+dlE62datRKUJpKvHRPnghJ87btGKw8CE8aJvSzaeyTp2IUtkedUkoIP vV1zjeXAk1ObIUPC+lS5sMIHepbi78I= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720104377; a=rsa-sha256; cv=none; b=OnUsBk0HVMQl3MXpTM+balh3/ymuwXxp6mIP/F2mYtagRUpbLIPUSKytRWikBeKvvPLPC4 YGBFkX3JEV9OO8YN/q/niepsS0viuOJMmOManmpNQUh/mBIvVY8FhqMy9VWfXsdupeuJ5x IdSC+Z12lpJbUFBPJ9w7GAWyVr1Q3EU= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=kt2WNqIN; spf=pass (imf22.hostedemail.com: domain of libang.linux@gmail.com designates 209.85.166.65 as permitted sender) smtp.mailfrom=libang.linux@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-io1-f65.google.com with SMTP id ca18e2360f4ac-7f620f349f9so31050139f.0 for ; Thu, 04 Jul 2024 07:46:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720104401; x=1720709201; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ovAGVS3VHRPu/ayJ7OgBZYBcLdsO3egzdp3KRf/I5wo=; b=kt2WNqINpkpdsffggpG1io1TgIdhGnJISocDDGRNz0yUeq1sXKIOXL/7o2Q85fyhdG lxeojBlbV8TThg+rHMux6l5LHxtp/tGu8QNv4Uq7UaV0BZGHP0PBlS8iDBhvIQ4kl1Sg dtl0vA6PmK2lFtlsbxhikAA6vQp2Sar1BdaQGMPlUxHtS8hzRJrjN7ar0Hb4CCRF+ZnY 7kW75JjPLYsN1WHmwZ4xm4MnWWEvfn/BP0ml0Al9J3D16Espa4t53ViCILWV6D84cT8n VeUWvBMS0zs9L4jghA4/rMU6FjUXFvNd5P/q9P2O8jksG04emIFQ75qnVl0BNSNo6U/R A3Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720104401; x=1720709201; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ovAGVS3VHRPu/ayJ7OgBZYBcLdsO3egzdp3KRf/I5wo=; b=VfD2KIS1KXG77Fewp2bv411rD5vwNET1MswFOdp2Q+rQ0MThhkntAIqy4ny4IRPCKQ GQYFcNl8N2a58oiGJsTEf66M7IDxzDVOu+BwOgupes+1NY8h/+2rasZ0kOgKldieo26L u8vVNa+HGlDHU5sEGovcS/QdrajKPFM1G89rUJM1CLEUwB+wFuJj3hyyg2K3zv2dGJ0E 9cNHWcPWvOknlQhiwQ6bFuK1eMXLYZXGJyUv+1rpXHvj8JxMNr0H7kXHruRG/qco5hun 4P9VdNX809+vvLre1Lw/C9laN0cRfWtS6UZq32NaLMS92xdEr/dYpP/Lmj+VGy+J5jlq nHYA== X-Forwarded-Encrypted: i=1; AJvYcCWKYQH1IF68BQO7A/TSWjtKrhIuqbyLYlsd/41QbQZuYlspaqYPfhWw5Fe/7AxM4TPrUxFS/+IVVaFm2SNSIWkqMPM= X-Gm-Message-State: AOJu0YwtqCwuCRNyHf4VP9kMyikWMvFJb/zfixr9K/mMGi+j5yMjLySj PlRpIwC4iOk9sTQDADdxOgOCfGbEcThUiGn+r9aXX27P+9Jh/Z+s X-Google-Smtp-Source: AGHT+IFdC1bMPgh1nTtndsMYHB4W0rmDbASqI2lZOfJfEaAmurqWXB3XbObe/2fTuuwrn3LykuqoYQ== X-Received: by 2002:a05:6602:e43:b0:7f6:200a:ba8c with SMTP id ca18e2360f4ac-7f66de8c749mr238274939f.1.1720104400628; Thu, 04 Jul 2024 07:46:40 -0700 (PDT) Received: from [192.168.3.24] ([36.24.57.127]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7080256af87sm12319914b3a.70.2024.07.04.07.46.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Jul 2024 07:46:40 -0700 (PDT) Message-ID: Date: Thu, 4 Jul 2024 22:46:29 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 4/6] mm: shmem: add mTHP support for anonymous shmem To: Baolin Wang , Ryan Roberts , akpm@linux-foundation.org, hughd@google.com Cc: willy@infradead.org, david@redhat.com, wangkefeng.wang@huawei.com, ying.huang@intel.com, 21cnbao@gmail.com, shy828301@gmail.com, ziy@nvidia.com, ioworker0@gmail.com, da.gomez@samsung.com, p.raghav@samsung.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <65796c1e72e51e15f3410195b5c2d5b6c160d411.1718090413.git.baolin.wang@linux.alibaba.com> <65c37315-2741-481f-b433-cec35ef1af35@arm.com> <475332ea-a80b-421c-855e-a663d1d5bfc7@linux.alibaba.com> Content-Language: en-US From: Bang Li In-Reply-To: <475332ea-a80b-421c-855e-a663d1d5bfc7@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C98A8C0013 X-Stat-Signature: y11wdimdkcfbwsuknpxw7hdiixu4npcy X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1720104401-441549 X-HE-Meta: U2FsdGVkX19MW5BqglBoDfAjnFuHP/0cFdRqlVk45+URszFbG7DtQq4pGn4Ky5GrM+L0qB8F5kTVyyKKDRkbBwsa+7dnOoCWVbmdrcVASowWNcGPgtGPSlX1kArP8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sulEXiBWCWmgWIlUNwIbt0fKcKM5t5gkHQNe1bZQo/5q+edWGNStAwL+xVZa6nfDvZ5dS0nPHUkaxGHZ4MiUUnlcq0m/yaUb2U8wQP6hNvLLdaPsjd9m5f9e+msGjBpAtvnSstaqkfM0YJnX43KDqUF1jD7zLyj8bRKOEUA7zWGJbF7gS4kXj/lZpk3IhaOG3liIVhZHFe2L4NMYwGBxmPWGsbkeh6dWGWoDGo04PfGXdfX7aDD4oH/yfwiBvpytYHSvEgP90yJ17t/Zw8iGNg7vw7AciD8dpg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hi Bao lin, On 2024/7/4 19:15, Baolin Wang wrote: > >>> + >>> +    /* >>> +     * Only allow inherit orders if the top-level value is 'force', >>> which >>> +     * means non-PMD sized THP can not override 'huge' mount option >>> now. >>> +     */ >>> +    if (shmem_huge == SHMEM_HUGE_FORCE) >>> +        return READ_ONCE(huge_shmem_orders_inherit); >> >> I vaguely recall that we originally discussed that trying to set >> 'force' on the >> top level control while any per-size controls were set to 'inherit' >> would be an >> error, and trying to set 'force' on any per-size control except the >> PMD-size >> would be an error? > > Right. > >> I don't really understand this logic. Shouldn't we just be looking at >> the >> per-size control settings (or the top-level control as a proxy for every >> per-size control that has 'inherit' set)? > > ‘force’ will apply the huge orders for anon shmem and tmpfs, so now we > only allow pmd-mapped THP to be forced. We should not look at per-size > control settings for tmpfs now (mTHP for tmpfs will be discussed in > future). > >> >> Then for tmpfs, which doesn't support non-PMD-sizes yet, we just >> always use the >> PMD-size control for decisions. >> >> I'm also really struggling with the concept of shmem_is_huge() >> existing along >> side shmem_allowable_huge_orders(). Surely this needs to all be >> refactored into >> shmem_allowable_huge_orders()? > > I understood. But now they serve different purposes: shmem_is_huge() > will be used to check the huge orders for the top level, for *tmpfs* > and anon shmem; whereas shmem_allowable_huge_orders() will only be > used to check the per-size huge orders for anon shmem (excluding tmpfs > now). However, as I plan to add mTHP support for tmpfs, I think we can > perform some cleanups. Please count me in, I'd be happy to contribute to the cleanup and enhancement process if I can. Thanks, Bang