Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp290092lqo; Tue, 7 May 2024 22:46:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXSIDsYn4HEjkgGmMoLZ+Y3VWeL2ea/Ch4iLeEZYjJ9AQtw+17r3FWuTIiwXz7wCwZhr+idMWgTmqNnJCj1Uz3/R9jX8Zg4jNcJupOAAA== X-Google-Smtp-Source: AGHT+IG+a4GNvpeVIZ5riFrTSFSiVNsit21D8WAKxxHvbEXJSQsm+tTczM3XDaIANgih9NIEU+1m X-Received: by 2002:a50:cd0d:0:b0:572:6249:96bc with SMTP id 4fb4d7f45d1cf-5731da68ee8mr898680a12.32.1715147178209; Tue, 07 May 2024 22:46:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715147178; cv=pass; d=google.com; s=arc-20160816; b=SCKT9kDK4Dq6bz1F42Ct6cHB20Z8vyMKMInb75VKECbCe1d5cPMMrFPKDAXQ0lniOc 7Bt+p3jVha5+/WybrUUhXrLRAk1lV4JZ6JNR9ymHUiJ37hJI2tCC9isZhPpNba42s8Fm ZRvI37LQr2w7HVhb38y1L22oHMxNXscil8iCSLYK9+FGLd109eI2y1Tv7ccXrWJ/iIb4 z/AwnAaEvWqPO7sTAJMlSX5JU9/1jfWptTG821Hr0FLGB99orEemGGo9wrB2F568CaYb m+oWVDA6fpugAETZx2/x+7zaNlNPMykhOThNZ6ni8jpMSv75VW59sgppA0DhFDzerApr duFA== 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=OzZltckyuroXeYNzcs/5r87Nh20cbeVKjeOhmTiFlQc=; fh=vztUzzI7BW0j6J1Fd2p9764XyaeA0+RfI5+T4q/ohK0=; b=OEqlKmFurbLjLVh0f1n6aButvCegWSrmVGthKKKixow9pcOoUpZPQREOZikzNvhA0B zY0BSTRn4t87UcD5iwmyE/Xtygpea6q2+P2RW957SGAnay4vnLcbPkOSYnAVlmzY3yl/ kL9PO5JrGSj4daa847GYLdlLRoNmUyH8Dwj/Sw3OhD45rIzBFYG7MMRRedeVM8UkF8h0 AqiV72AMwudmJnSfZ/wAs5BpMG57htTZCQgDAqQtd+xnpzIXf9yUk/L/I1s8FeRckCeM jeaLSyl40FgejRIERuGpc3lMIqcuZPYxFS3YYWJyOTLKgyuuEwXIhZkqpjzUCcNPoDyg tOvw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=qOHyCnLz; 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-172711-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172711-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 am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id bm22-20020a0564020b1600b00572a75d5fbbsi6648330edb.400.2024.05.07.22.46.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 22:46:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172711-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=qOHyCnLz; 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-172711-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172711-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 am.mirrors.kernel.org (Postfix) with ESMTPS id E88011F24072 for ; Wed, 8 May 2024 05:46:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 593C817BAE; Wed, 8 May 2024 05:46:03 +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="qOHyCnLz" Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) (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 6EBD81756A for ; Wed, 8 May 2024 05:45:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.98 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715147161; cv=none; b=UR3FoPAkWV8sD3l2ZTYJElKoJlH+3hIrTO4TyEMTKNyPLYN5pvUWGahFQhql9bN4ur+zjqT3i9TZEVf1PMFc6ZliDhBmsoWZcaLLG7e6DI8eVXhpmLM8wGaNfv0EoyIhBPSUkcngtcBg9+P8iAfg4s4AtzCqBnI+/9v3TA0rBRo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715147161; c=relaxed/simple; bh=J21Eo2tKBXr5KMuTKsw0F3/e2fy1RaUgXCNjUlYRb7M=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=tdkXkpdE+cP2QP3gj+7lkRWvTwYpbjCYzw80UlO413odjR37DL+peH5EkmtB3wJI5+x4N47/nZi567TT4Ym/Q+CtldI+Iq3T7OZ0xS9kjPBbRv+FSjOp1j4lDEplc7c+Q6DHCBfCNnDNTIr6+lmsz5PH64lc2JrEm8W8dihvOAA= 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=qOHyCnLz; arc=none smtp.client-ip=115.124.30.98 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=1715147152; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=OzZltckyuroXeYNzcs/5r87Nh20cbeVKjeOhmTiFlQc=; b=qOHyCnLzNHCk1K1DmBY9BaxlaEUIBAfg7Jh4RlWMPPdDR+HW0inxWz0FG2vbneIcGMtEsIYAIHuofHvzEKhCOVpByI4CUwXlJ5XiBzHdtfG4kqM3R1gGf5osqADicxRb7nzcRkJbyfmmslgWgat7U1ErGHk7DRY5GiDvcUQ+UYk= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R431e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033032014031;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0W62Fj9e_1715147148; Received: from 30.97.56.69(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W62Fj9e_1715147148) by smtp.aliyun-inc.com; Wed, 08 May 2024 13:45:50 +0800 Message-ID: Date: Wed, 8 May 2024 13:45:48 +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 0/8] add mTHP support for anonymous shmem 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: From: Baolin Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/5/7 18:20, Ryan Roberts wrote: > On 06/05/2024 09:46, Baolin Wang wrote: >> Anonymous pages have already been supported for multi-size (mTHP) allocation >> through commit 19eaf44954df, that can allow THP to be configured through the >> sysfs interface located at '/sys/kernel/mm/transparent_hugepage/hugepage-XXkb/enabled'. >> >> However, the anonymous shared pages will ignore the anonymous mTHP rule >> configured through the sysfs interface, and can only use the PMD-mapped >> THP, that is not reasonable. Many implement anonymous page sharing through >> mmap(MAP_SHARED | MAP_ANONYMOUS), especially in database usage scenarios, >> therefore, users expect to apply an unified mTHP strategy for anonymous pages, >> also including the anonymous shared pages, in order to enjoy the benefits of >> mTHP. For example, lower latency than PMD-mapped THP, smaller memory bloat >> than PMD-mapped THP, contiguous PTEs on ARM architecture to reduce TLB miss etc. >> >> The primary strategy is similar to supporting anonymous mTHP. Introduce >> a new interface '/mm/transparent_hugepage/hugepage-XXkb/shmem_enabled', >> which can have all the same values as the top-level > > Didn't we agree that "force" would not be supported for now, and would return an > error when attempting to set for a non-PMD-size hugepage-XXkb/shmem_enabled (or > indirectly through inheritance)? Yes. Sorry, I did not explain it in detail in the cover letter. Please see patch 5 you already commented.