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 1E72AC27C4F for ; Tue, 11 Jun 2024 02:53:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A1DC36B009D; Mon, 10 Jun 2024 22:53:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9CEA26B009E; Mon, 10 Jun 2024 22:53:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 895F06B009F; Mon, 10 Jun 2024 22:53:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 6B55B6B009D for ; Mon, 10 Jun 2024 22:53:28 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 17B78C0B04 for ; Tue, 11 Jun 2024 02:53:28 +0000 (UTC) X-FDA: 82217086896.03.B96E676 Received: from out30-118.freemail.mail.aliyun.com (out30-118.freemail.mail.aliyun.com [115.124.30.118]) by imf03.hostedemail.com (Postfix) with ESMTP id E9C7D20008 for ; Tue, 11 Jun 2024 02:53:24 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=xW5z7yHi; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf03.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.118 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718074406; 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=Dl8n43VI8mn4utlO/CKQEcJ3bnZnLyAzO5cH3rC0sRo=; b=M5gbcUwyAGP98UDf9D09GYhCF6zo613klJG5EUvLjQ1WL4/uEfWzMedq3PxCNZxOS5vnOQ HOyMGXUWA//+Ct2iaBIpiC95N3MJnaBFyy395Xi8Zh8o+hMajpuUJpOavoyQbtBoAJbF2j O6fyyCqCiTcR/KepNkbBqdqVV0Msh9k= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=xW5z7yHi; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf03.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.118 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718074406; a=rsa-sha256; cv=none; b=QmfPr6n6EULKUP370lmTKImIf39ck/b5hL3hmgbuWOBJVaMa8YujXCrvedWgpwOi/PCZDk LZ1TJrmJOM9avJu8gPUDI7S/QsGgxUpoX16Tkxeo+U1QJBjueNSa8lj0DaDnQKnYASKnpm 8sCMuKP25xf+Z4MZHYAIjXfcle1lzBo= DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1718074401; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=Dl8n43VI8mn4utlO/CKQEcJ3bnZnLyAzO5cH3rC0sRo=; b=xW5z7yHiOmRn0HWTS94X8RKVyzYrX8dz9aBgQzLhEgZvPv9PPcDnmhk8SVQ5Pos2BsNCdhnQTRW7+XrVynO/YGmnlPppDoeAdl0yMrxEUCLfzjxiL+sGbCYYm43huxrCCwlKvA/A5uFa5MoXNVedlw1dlfr7Nl3A4n3xcXArO7A= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R101e4;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=15;SR=0;TI=SMTPD_---0W8EobXH_1718074399; Received: from 30.97.56.68(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W8EobXH_1718074399) by smtp.aliyun-inc.com; Tue, 11 Jun 2024 10:53:20 +0800 Message-ID: <18b99bf2-a9c9-4abe-8345-e9864502c40e@linux.alibaba.com> Date: Tue, 11 Jun 2024 10:53:19 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 0/6] add mTHP support for anonymous shmem To: Daniel Gomez Cc: "akpm@linux-foundation.org" , "hughd@google.com" , "willy@infradead.org" , "david@redhat.com" , "wangkefeng.wang@huawei.com" , "ying.huang@intel.com" , "21cnbao@gmail.com" <21cnbao@gmail.com>, "ryan.roberts@arm.com" , "shy828301@gmail.com" , "ziy@nvidia.com" , "ioworker0@gmail.com" , Pankaj Raghav , "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 X-Rspamd-Queue-Id: E9C7D20008 X-Stat-Signature: xpfrtz1pdmsibepf4exh7fat6rdykoz5 X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1718074404-531622 X-HE-Meta: U2FsdGVkX1/ZhyJyD+A4cAx6yHoZg3trfhoacIfGktRBtFfxXtWPA0XEzmZ66hTdLvKXyU5NwyvVKCMICVKpG35K6vpUWwRwrfXq8sA0liAhzk+7/Zhjy5p7GvazJJWc6VCiBYX+St/lyhJmcT/Wyrolg2iuz/Bg4Wzj6+2tX6tTLLinVj1xYpxAzx3g5lOuVx3T30aQ/u18pPXhAln7T1xVYknbedUJMlQKqRZibedDYJcffrWD7MEnW9ml8UL4PVD4+CvL9IdG78zR5YOnxQ0z4B1TndH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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: On 2024/6/10 20:10, Daniel Gomez wrote: > Hi Baolin, > > On Tue, Jun 04, 2024 at 06:17:44PM +0800, 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 shmem 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. >> >> As discussed in the bi-weekly MM meeting[1], the mTHP controls should control >> all of shmem, not only anonymous shmem, but support will be added iteratively. >> Therefore, this patch set starts with support for anonymous shmem. >> >> The primary strategy is similar to supporting anonymous mTHP. Introduce >> a new interface '/mm/transparent_hugepage/hugepage-XXkb/shmem_enabled', >> which can have almost the same values as the top-level >> '/sys/kernel/mm/transparent_hugepage/shmem_enabled', with adding a new >> additional "inherit" option and dropping the testing options 'force' and >> 'deny'. By default all sizes will be set to "never" except PMD size, which >> is set to "inherit". This ensures backward compatibility with the anonymous >> shmem enabled of the top level, meanwhile also allows independent control of >> anonymous shmem enabled for each mTHP. >> >> Use the page fault latency tool to measure the performance of 1G anonymous shmem > > I'm not familiar with this tool. Could you share which repo/tool you are > referring to? Sure. The git repo is: https://github.com/gormanm/pft.git And I did a little changes to test anon shmem: diff --git a/pft.c b/pft.c index 3ab1457..bbcd7e6 100644 --- a/pft.c +++ b/pft.c @@ -739,7 +739,7 @@ alloc_test_memory(void) int j; if (do_shm) { - if (p = alloc_shm(bytes)) { + if (p = valloc_shared(bytes)) { do_mbind(p, bytes); do_noclear(p, bytes); } > Also, are you running or are you aware of any other tools/tests available for > shmem that we can use to make sure we do not introduce any regressions? I did run the mm selftest cases, as well as some testing cases I wrote for anon shmem.