Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp253337lqt; Thu, 6 Jun 2024 02:33:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVg28zvEQtPgasdprFYmhiCjv/uWq4aTMZ7BnQ2ebWjJiRfSeIzQ2oHfUyILjP848popzq9e5OLXyZjcGFUynpxCEb+h1/ykOsqUAHbig== X-Google-Smtp-Source: AGHT+IHxUMQbptHlZyT+5MuttuCgNl26KJN740N4BKmbAV2SN1fg5m8bnBoGLhecHKvrjHaYYDrD X-Received: by 2002:a17:907:920d:b0:a67:490a:8162 with SMTP id a640c23a62f3a-a6c760a69d4mr164864366b.13.1717666418701; Thu, 06 Jun 2024 02:33:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717666418; cv=pass; d=google.com; s=arc-20160816; b=pijFOxQD4QhUkskN5Sp/LcDlWji73gz1g7Iu2AcTL4x3YBy7ICg3nrD8ZaQ9w3f+ei c9EiVO4qfZFZB1s1q28qWl7hKtKDeIQTdqu2c0xguJG3kPnsdaAnUvrOtF8nDNn/wliT 01z6+tkDHIQRwhKD9XcQY0pEsPcS5PtYLkG3XHe5/ceYq7WVARMW53aoGeetETv2ppfo 9TtSp95+N0wqATPYi9n7cJsSUHqisNqVAXtilMCdxXUFTKU5xSSwZeTHWy9vWGrpp12O 3nXVZAiXgEBa8RvawlF8tQphd7aJrlBk7dXn9qKe8CJGOdZStSrVQ8tB+3Nq3AebHg5Z bdIw== 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=8q8Fkl2jA1U5hSAvLLBPc/Mm5V5YlZfvuHx62cOLGLY=; fh=7SVSWDT8lrCp7R0qAVEcjtbbCGrf4Te0sSKHv/9WAGQ=; b=UKCkihg0Hb3ANTObEAfIxGIoUr4gqn8a5g6l2B8E6khoBJVmMsitpEYGptNkCdrX+T Geh09eTehDhSc9ExoFH6rfE1dsDg/E2EuOfSlZWQWorsY34t2eVA7sfVjZJgrjJGg5+z Wm/okv8I5Av7UtKle3pUumz87vCp/PhGVTt6CApB2rhp9sVQNOfHFT7uKH3cwRry/9pE sXKYg6K9jWHQorl/GPzKDe7eGGIDoKRNAStUIb7Q9Py6u/nlIUn212lTmTWpwALwGVXX 0QmM1180gziUqI3PZSGkCZmWiW0BfxxDYv/M9FqHplst7OKw5DH5ZqBG6QBiX0AO7609 9+sg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=eiXEEJDn; 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-204012-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204012-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 a640c23a62f3a-a6c8898f70csi3717066b.5.2024.06.06.02.33.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 02:33:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204012-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=eiXEEJDn; 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-204012-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204012-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 6DF861F21B2A for ; Thu, 6 Jun 2024 09:33:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 58740153506; Thu, 6 Jun 2024 09:31:37 +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="eiXEEJDn" Received: from out30-118.freemail.mail.aliyun.com (out30-118.freemail.mail.aliyun.com [115.124.30.118]) (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 32CE9153517 for ; Thu, 6 Jun 2024 09:31:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.118 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717666296; cv=none; b=I7hau2YZkGbxUT8ZUAzxxoZ4y9EbfokMYgKAEZU051/HQfIIEubEKCFahiD/vAVi2m1jy8B4aHBt2BvQ7YjjKVhc3HVSNG2hZvwwtEBHKJl3fMGyzYPQhV74pR/bLSG6c7uJdC/FjRXEZaR+hICturUNmH0PmaMdX35aPsC28F8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717666296; c=relaxed/simple; bh=lhNvlZLKk6LbkWN2wiQs55+WfQxtSjp304vt1wWAFNQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=DiPoOyjCwWZvCVebRTLKBwTbGsjvJoqKBKjkJv8d0l9G65xs7/GbgHNpbSZcOkicir3eo803VJZW9sgwfGmGbQuIuL4xVb7oft6/4eBnxOewQBDBErAc7GhyWc4KFvUJt73IeMq9H2fjvD59raick643QTweLSxdKSjk6J06goo= 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=eiXEEJDn; arc=none smtp.client-ip=115.124.30.118 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=1717666286; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=8q8Fkl2jA1U5hSAvLLBPc/Mm5V5YlZfvuHx62cOLGLY=; b=eiXEEJDnRadImuDaFAYchG6cd16iRfW/i4iqCeEbr0Y0IBEoKrzWGv6+Qc4dUPTi9MhN6TfGF7BcZKyiAkphIvRvVnPpjX95Utx9Er2h6d8zzb643BWNx1bIv3b0h1Oo4WyaH587tGhaJpz8cbLT/E9Wmxv97UE/DlU0J32J5Iw= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037067113;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0W7xuZWn_1717666283; Received: from 30.97.56.72(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W7xuZWn_1717666283) by smtp.aliyun-inc.com; Thu, 06 Jun 2024 17:31:24 +0800 Message-ID: Date: Thu, 6 Jun 2024 17:31:23 +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 v3 0/6] add mTHP support for anonymous shmem To: David Hildenbrand , Daniel Gomez Cc: "akpm@linux-foundation.org" , "hughd@google.com" , "willy@infradead.org" , "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: <502fb3df-b42b-4f0c-a98d-348c3d544721@redhat.com> <5mezgqzg7wmd4iq2d2q3aentziosetwcll3tgdbl3mhriseyv3@pgxsux7qvxno> From: Baolin Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/6/6 16:38, David Hildenbrand wrote: > On 06.06.24 05:31, Baolin Wang wrote: >> >> >> On 2024/6/4 20:05, Daniel Gomez wrote: >>> On Tue, Jun 04, 2024 at 05:45:20PM +0800, Baolin Wang wrote: >>>> >>>> >>>> On 2024/6/4 16:18, Daniel Gomez wrote: >>>>> On Fri, May 31, 2024 at 01:13:48PM +0200, David Hildenbrand wrote: >>>>>>>> >>>>>>>> As a default, we should not be using large folios / mTHP for any >>>>>>>> shmem, >>>>>>>> just like we did with THP via shmem_enabled. This is what this >>>>>>>> series >>>>>>>> currently does, and is aprt of the whole mTHP user-space >>>>>>>> interface design. >>>>>>>> >>>>>>>> Further, the mTHP controls should control all of shmem, not only >>>>>>>> "anonymous shmem". >>>>>>> >>>>>>> Yes, that's what I thought and in my TODO list. >>>>>> >>>>>> Good, it would be helpful to coordinate with Daniel and Pankaj. >>>>> >>>>> I've integrated patches 11 and 12 from the lsf RFC thread [1] on >>>>> top of Baolin's >>>>> v3 patches. You may find a version in my integration branch here >>>>> [2]. I can >>>>> attach them here if it's preferred. >>>>> >>>>> [1] >>>>> https://lore.kernel.org/all/20240515055719.32577-1-da.gomez@samsung.com/ >>>>> [2] >>>>> https://protect2.fireeye.com/v1/url?k=a23e7c06-c3b56926-a23ff749-74fe485fb347-371ca2bfd5d9869f&q=1&e=6974304e-a786-4255-93a7-57498540241c&u=https%3A%2F%2Fgitlab.com%2Fdkruces%2Flinux-next%2F-%2Fcommits%2Fnext-20240604-shmem-mthp >>>>> >>>>> The point here is to combine the large folios strategy I proposed >>>>> with mTHP >>>>> user controls. Would it make sense to limit the orders to the >>>>> mapping order >>>>> calculated based on the size and index? >>>> >>>> IMO, for !anon shmem, this change makes sense to me. We should >>>> respect the >>>> size and mTHP should act as a order filter. >>> >>> What about respecing the size when within_size flag is enabled? Then, >>> 'always' >>> would allocate mTHP enabled folios, regardless of the size. And 'never' >>> would ignore mTHP and size. So, 'never' can be used for this 'safe' >>> boot case >>> mentioned in the discussion. >> >> Looks reasonable to me. What do you think, David? >> > > That mimics existing PMD-THP behavior, right? > > With "within_size", we must not exceed the size, with "always", we may > exceed the size. Yes, I think so. >> And what about 'advise' option? Silimar to 'within_size'? > > Good question. What's the behavior of PMD-THP? I would assume it behaves > like "within_size", because in the common case we mmap (+advise) only > within the size of the file, not exceeding it. Yes, that is also my understanding. > (the always option, as I learned during the meeting, is primarily > helpful when writing to tmpfs files in an append-fashion. With > mmap()+madvise() that doesn't quite happen) >