Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp88336lqp; Mon, 10 Jun 2024 19:53:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVVBO8fdEVFJsHzicGp6nokG1Ny9KcWzVEmQdAwNf7Hx1eUQchTlyAmBkbUTTm/amGbTrIJR3XfB2dqDENB6zzX5ie/ui9gaXfWnRVMMg== X-Google-Smtp-Source: AGHT+IFEri6iLR8zdr1/e7YGtKJVcvucv45/FJ675iBsVwwzi9NZr7dLkdE+VG7QNmKbxluwfVy7 X-Received: by 2002:a05:620a:37a2:b0:792:f429:9e9 with SMTP id af79cd13be357-7953c31a4dfmr1017882085a.22.1718074415499; Mon, 10 Jun 2024 19:53:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718074415; cv=pass; d=google.com; s=arc-20160816; b=Mx8aW0EVt0Z85DgLrbMFUmXaOln2uErOBH3Q9jRfl1eYt9y2ocl8JGyP5orhedprwh 6Do4IVI8Rvl4aTsLv/9t+jGcOsBlAp0kWCGk7o3gQB+VNprGDuzjKN2wl2IfI6LlDgDd TEHfbRgsR1mZzQEnoUsvQ0UtNuvXUCjnqT9e1etIa6QZFCItYZ0maIhxM/XDpnOnTYkk 70Ar/pZuNBcpw7N1ahXnVZTyY/nyzPVm14nKixt/UheNkcNO24TbpXszsg24MiklrGxZ ZQfJjpP7gFD91sUxvZe+xaB2pv8sNo32Tni0hOMiS/bakzAj8HV/hEdqG8RqTU+S5KWw PcBg== 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=Dl8n43VI8mn4utlO/CKQEcJ3bnZnLyAzO5cH3rC0sRo=; fh=5UCACJcEcVJNNXQ6AgzWwHop8IRQO4SkE0j+bkNbAb0=; b=HLYYuTGq6nhLzOH2sjF7OwzI0/SmxEz4Nv1KQ3O8YpRykbriXM0NruqN5WhNsl2m78 UNQtd8Jt+AXxj5loONnS9TliR/Q6GwWCpxovW8OuWwXK00wbzBOjMn8nTOIkBHXDlDVE SWzxxTDmn0RXNpIIvHau4M6Jg8A212LCE2fx86Wlg9Hxiph7UiwdIWceCsTLHIzLiLIW hwjw+pw1h8HcGY7+tennGipZIgkWgJh/FEkcf2BrMd8mvPL2jdacLvPtfremNL1oeNwW CsPTy9jPvHVQ8j3hljc+ht8tfXTNbI9DDCzx51uBhJDZKztD5RMHl3xR69JxMFicap2E lw6A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=nI8taSAG; 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-209200-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209200-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 ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-7955981daeasi624265685a.713.2024.06.10.19.53.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 19:53:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209200-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=nI8taSAG; 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-209200-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209200-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C23111C22D24 for ; Tue, 11 Jun 2024 02:53:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3384116F85E; Tue, 11 Jun 2024 02:53:29 +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="nI8taSAG" 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 B3FB2A2A for ; Tue, 11 Jun 2024 02:53: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=1718074408; cv=none; b=hpx1z6mlrRJ52bpe9Ta2BwVlr2zx7vpOPfG/i6A5VaAK+ykumLiXcBmCS5nPdRu9JQ4VN3UE8E6bi/Q9RWAy0GhG2FOKu62EwE8MZipJsuR/cj/SJsfIYBXVaK6gYsQOOR+3MESNTSl7S3R93tr3n8cg3AwezMrsc6XsEJh5yeY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718074408; c=relaxed/simple; bh=ShNxA8sdFwHAawK2Hgl/KWSFDJOd4xSvXw6uCEhExP0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=BHk5V3ZArmL36o8iJzLu+i+jJfSJI6aqOZjX1Bpcv43+p+1iLIfJ+JZFYUUrejW4T/HtI4MfnpgSb99sjgUfuwUm4NQq6g/xynaEg6r2saQ97L3cpqonHmKDc9D1gLNwB0ClRExuUJYkCSv8oCk6FhvR58a6A3ku0RYEdKc7gd8= 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=nI8taSAG; 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=1718074402; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=Dl8n43VI8mn4utlO/CKQEcJ3bnZnLyAzO5cH3rC0sRo=; b=nI8taSAG2UkV+hbuotEMv6natRFHljdrqcaMAu4hK8b6rI/7sYwkvLFxKXMONaXzpeZYfDFmth5nRWnh5STKE89nkOETNrh70N0/MtQ7jpid9ii0zKr5dHFKTBbr5BsDsXbU2BiMnnoBKwE5N5OKOZGjdchQbdhm7ErfIRRC2zw= 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 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 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 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.