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 X-Spam-Level: X-Spam-Status: No, score=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC876C432BE for ; Sun, 1 Aug 2021 04:02:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A291C60249 for ; Sun, 1 Aug 2021 04:02:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229836AbhHAECG (ORCPT ); Sun, 1 Aug 2021 00:02:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbhHAECD (ORCPT ); Sun, 1 Aug 2021 00:02:03 -0400 Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5614FC0613CF for ; Sat, 31 Jul 2021 21:01:55 -0700 (PDT) Received: by mail-qk1-x732.google.com with SMTP id x3so13533103qkl.6 for ; Sat, 31 Jul 2021 21:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=Bamtlf1xYDbsxVIm2+Hj57JkHWBBhyBU5JpXT15STbM=; b=LSHEuW5/YX6Gd4nLb2XE10CrvjgFEJIu8hjBL06szNHTitQHTQiecsmoEnUEH8l1ks BMTWEgFKO4ZrE6GdFu62kquXtXG2gHhFe1CLhSqRbqhDp0jK0ISilfzcVvpuL8CdcT8t J6r+US2mhB1QjthfCD7/udVR2nJDNYZkq/+4IIMvzFSsIpLTg/0oZVVd1eyM9J5LzHqA k8uOLtSfxwq4dvW4HDVzWZ0bGHVN9QcgEc61iA+kgMyCPOeEFEEPw/axIkw9ppd6kQrg zXYtv2xnLk/qo0zqNHc8zWazozt+Uw3mnrjShjjrJBtfRdbjAtHLiFjVxwanehVAMh5O soPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=Bamtlf1xYDbsxVIm2+Hj57JkHWBBhyBU5JpXT15STbM=; b=Wk1GXcLHj8nHgLfPTzlYRZyDsY4S2hA0XTSW/hJ93S/1k9IoYxlS09Eak1T85CH5xB hPR1ncMClaw1wSROVnRcbCF4pyL8bzc75L6iQifVOm/9bXcPJ7e0Mp+ltvTkbuOki2zU /wrZ3qDz7i5pM4xWLP7zRHV4s7YaIgFMpTuGMK3CWG4JAm1Ilszuj5WZU+nlcprnM/p3 SeDkoS4yy9YSi/Ozjq1HlWuRgWDgGRsj4hORhyPIz9cnLLHCXgdT14+3LBTNSED/P0Ay f0j6VVKeaY0cAVdxzcjT58mCeNpVuJl90ptrKo7W9q/WpTdTzH3jr29Jdq4+gxJtvvXH I8gg== X-Gm-Message-State: AOAM533jLkprTHuxkcTVFRcHc3IZXgbDJRknQhAl0ZI45mQhCiP0kev6 HKLvZLT8MlVMBHUj/b8Iq468DQ== X-Google-Smtp-Source: ABdhPJwpiOW6lPa9+HxDKJhJy9Z92W83ZI44clBKHCglmMG1irmPwdmlSECTwZypIvw95ecMuWY1tw== X-Received: by 2002:a37:9b14:: with SMTP id d20mr9473258qke.368.1627790514364; Sat, 31 Jul 2021 21:01:54 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id 71sm2818101qtc.97.2021.07.31.21.01.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Jul 2021 21:01:53 -0700 (PDT) Date: Sat, 31 Jul 2021 21:01:51 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Yang Shi cc: Hugh Dickins , Andrew Morton , Shakeel Butt , "Kirill A. Shutemov" , Miaohe Lin , Mike Kravetz , Michal Hocko , Rik van Riel , Christoph Hellwig , Matthew Wilcox , "Eric W. Biederman" , Alexey Gladkov , Chris Wilson , Matthew Auld , Linux FS-devel Mailing List , Linux Kernel Mailing List , linux-api@vger.kernel.org, Linux MM Subject: Re: [PATCH 04/16] huge tmpfs: revert shmem's use of transhuge_vma_enabled() In-Reply-To: Message-ID: <55526ab1-4280-9538-51d7-6669b8a97f@google.com> References: <2862852d-badd-7486-3a8e-c5ea9666d6fb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 30 Jul 2021, Yang Shi wrote: > On Fri, Jul 30, 2021 at 12:36 AM Hugh Dickins wrote: > > > > 5.14 commit e6be37b2e7bd ("mm/huge_memory.c: add missing read-only THP > > checking in transparent_hugepage_enabled()") added transhuge_vma_enabled() > > as a wrapper for two very different checks: shmem_huge_enabled() prefers > > to show those two checks explicitly, as before. > > Basically I have no objection to separating them again. But IMHO they > seem not very different. Or just makes things easier for the following > patches? Well, it made it easier to apply the patch I'd prepared earlier, but that was not the point; and I thought it best to be upfront about the reversion, rather than hiding it in the movement. The end result of the two checks is the same (don't try for huge pages), and they have been grouped together because they occurred together in several places, and both rely on "vma". But one check is whether the app has marked that address range not to use THPs; and the other check is whether the process is running in a hierarchy that has been marked never to use THPs (which just uses vma to get to mm to get to mm->flags (whether current->mm would be more relevant is not an argument I want to get into, I'm not at all sure)). To me those are very different; and I'm particularly concerned to make MMF_DISABLE_THP references visible, since it did not exist when Kirill and I first implemented shmem huge pages, and I've tended to forget it: but consider it more in this series. Hugh > > > > > Signed-off-by: Hugh Dickins > > --- > > mm/shmem.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/mm/shmem.c b/mm/shmem.c > > index ce3ccaac54d6..c6fa6f4f2db8 100644 > > --- a/mm/shmem.c > > +++ b/mm/shmem.c > > @@ -4003,7 +4003,8 @@ bool shmem_huge_enabled(struct vm_area_struct *vma) > > loff_t i_size; > > pgoff_t off; > > > > - if (!transhuge_vma_enabled(vma, vma->vm_flags)) > > + if ((vma->vm_flags & VM_NOHUGEPAGE) || > > + test_bit(MMF_DISABLE_THP, &vma->vm_mm->flags)) > > return false; > > if (shmem_huge == SHMEM_HUGE_FORCE) > > return true; > > -- > > 2.26.2 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 X-Spam-Level: X-Spam-Status: No, score=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5977DC4338F for ; Sun, 1 Aug 2021 04:01:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ECF1A61058 for ; Sun, 1 Aug 2021 04:01:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org ECF1A61058 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 0DF356B0033; Sun, 1 Aug 2021 00:01:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 090208D0001; Sun, 1 Aug 2021 00:01:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E9A006B005D; Sun, 1 Aug 2021 00:01:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0224.hostedemail.com [216.40.44.224]) by kanga.kvack.org (Postfix) with ESMTP id CC5506B0033 for ; Sun, 1 Aug 2021 00:01:55 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6A99D8249980 for ; Sun, 1 Aug 2021 04:01:55 +0000 (UTC) X-FDA: 78425163390.15.F6C878F Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) by imf09.hostedemail.com (Postfix) with ESMTP id 2168F3000133 for ; Sun, 1 Aug 2021 04:01:55 +0000 (UTC) Received: by mail-qk1-f174.google.com with SMTP id k7so13516059qki.11 for ; Sat, 31 Jul 2021 21:01:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=Bamtlf1xYDbsxVIm2+Hj57JkHWBBhyBU5JpXT15STbM=; b=LSHEuW5/YX6Gd4nLb2XE10CrvjgFEJIu8hjBL06szNHTitQHTQiecsmoEnUEH8l1ks BMTWEgFKO4ZrE6GdFu62kquXtXG2gHhFe1CLhSqRbqhDp0jK0ISilfzcVvpuL8CdcT8t J6r+US2mhB1QjthfCD7/udVR2nJDNYZkq/+4IIMvzFSsIpLTg/0oZVVd1eyM9J5LzHqA k8uOLtSfxwq4dvW4HDVzWZ0bGHVN9QcgEc61iA+kgMyCPOeEFEEPw/axIkw9ppd6kQrg zXYtv2xnLk/qo0zqNHc8zWazozt+Uw3mnrjShjjrJBtfRdbjAtHLiFjVxwanehVAMh5O soPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=Bamtlf1xYDbsxVIm2+Hj57JkHWBBhyBU5JpXT15STbM=; b=UkT1z97hBTldWejvuNyrq6nW6MAhGbFerRSHVBQRsd+LgvteUGk1TOVndo7QYq2JNU ZBSX7M3i2C2G3WOV8cGEnpcNm/ySxbaXvx9bO0721xIy4+osi46sGU4DVCGSgneeNFX8 VxDSC+8ovW2kc5rcQxjoz3F4BgPx8k1qXG9wix4mplXi2cFSUgdj3sT7KXN5F2TilFI8 SuJvtMMny5//vgu+3EcU6V5Wq8GIP9AI2ZudNF+oLgqasUVBWmD5NssAN3cwbjXYS8uZ yFKQpRROJ3OKW29s9qrUXrYAxb86NmucdalXqxNUN5fjChmM44G+D6iJLd7jqYsM0aME 1jdA== X-Gm-Message-State: AOAM530cJdSCNGvnz5pZf6E0EBeTE0YuLZ0Su5txAVcpKGDASiHG17MN nEibmKY+FlkdTj+BvXyZJBAqEQ== X-Google-Smtp-Source: ABdhPJwpiOW6lPa9+HxDKJhJy9Z92W83ZI44clBKHCglmMG1irmPwdmlSECTwZypIvw95ecMuWY1tw== X-Received: by 2002:a37:9b14:: with SMTP id d20mr9473258qke.368.1627790514364; Sat, 31 Jul 2021 21:01:54 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id 71sm2818101qtc.97.2021.07.31.21.01.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Jul 2021 21:01:53 -0700 (PDT) Date: Sat, 31 Jul 2021 21:01:51 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Yang Shi cc: Hugh Dickins , Andrew Morton , Shakeel Butt , "Kirill A. Shutemov" , Miaohe Lin , Mike Kravetz , Michal Hocko , Rik van Riel , Christoph Hellwig , Matthew Wilcox , "Eric W. Biederman" , Alexey Gladkov , Chris Wilson , Matthew Auld , Linux FS-devel Mailing List , Linux Kernel Mailing List , linux-api@vger.kernel.org, Linux MM Subject: Re: [PATCH 04/16] huge tmpfs: revert shmem's use of transhuge_vma_enabled() In-Reply-To: Message-ID: <55526ab1-4280-9538-51d7-6669b8a97f@google.com> References: <2862852d-badd-7486-3a8e-c5ea9666d6fb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 2168F3000133 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b="LSHEuW5/"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf09.hostedemail.com: domain of hughd@google.com designates 209.85.222.174 as permitted sender) smtp.mailfrom=hughd@google.com X-Stat-Signature: 4hd3jr8jjpx57yd8bxx8wzw78myaiwde X-HE-Tag: 1627790515-557173 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: On Fri, 30 Jul 2021, Yang Shi wrote: > On Fri, Jul 30, 2021 at 12:36 AM Hugh Dickins wrote: > > > > 5.14 commit e6be37b2e7bd ("mm/huge_memory.c: add missing read-only THP > > checking in transparent_hugepage_enabled()") added transhuge_vma_enabled() > > as a wrapper for two very different checks: shmem_huge_enabled() prefers > > to show those two checks explicitly, as before. > > Basically I have no objection to separating them again. But IMHO they > seem not very different. Or just makes things easier for the following > patches? Well, it made it easier to apply the patch I'd prepared earlier, but that was not the point; and I thought it best to be upfront about the reversion, rather than hiding it in the movement. The end result of the two checks is the same (don't try for huge pages), and they have been grouped together because they occurred together in several places, and both rely on "vma". But one check is whether the app has marked that address range not to use THPs; and the other check is whether the process is running in a hierarchy that has been marked never to use THPs (which just uses vma to get to mm to get to mm->flags (whether current->mm would be more relevant is not an argument I want to get into, I'm not at all sure)). To me those are very different; and I'm particularly concerned to make MMF_DISABLE_THP references visible, since it did not exist when Kirill and I first implemented shmem huge pages, and I've tended to forget it: but consider it more in this series. Hugh > > > > > Signed-off-by: Hugh Dickins > > --- > > mm/shmem.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/mm/shmem.c b/mm/shmem.c > > index ce3ccaac54d6..c6fa6f4f2db8 100644 > > --- a/mm/shmem.c > > +++ b/mm/shmem.c > > @@ -4003,7 +4003,8 @@ bool shmem_huge_enabled(struct vm_area_struct *vma) > > loff_t i_size; > > pgoff_t off; > > > > - if (!transhuge_vma_enabled(vma, vma->vm_flags)) > > + if ((vma->vm_flags & VM_NOHUGEPAGE) || > > + test_bit(MMF_DISABLE_THP, &vma->vm_mm->flags)) > > return false; > > if (shmem_huge == SHMEM_HUGE_FORCE) > > return true; > > -- > > 2.26.2