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=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 B3AAAC43214 for ; Mon, 2 Aug 2021 20:39:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A05E360F35 for ; Mon, 2 Aug 2021 20:39:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231503AbhHBUj0 (ORCPT ); Mon, 2 Aug 2021 16:39:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231165AbhHBUjY (ORCPT ); Mon, 2 Aug 2021 16:39:24 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10B20C06175F; Mon, 2 Aug 2021 13:39:14 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id go31so32833195ejc.6; Mon, 02 Aug 2021 13:39:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=z+1ZVGdug029BKztuBflcFM502/rjs3mo1eYtrMifDk=; b=WpqW6gbPXWmSXSnBXN8wuQVcUZ5E+920VtDCBI9sJOXAr5tN2Vf5zVNcGKewIC7PYJ 1gM06RAbNtITBSUxFkYEWFDPQsnfX3ekTklSXHkCXyK/p1X8Mk9fXWBdHarsIreOLC6l J+4ji/fyHzEfPW+YKKlN/ZKuW0fUwUeqdBWZSNtLgQAQRIfwvu2llBdvR/ZYKE/ceJAD RC/VI9WxFcMwJzOrdM/OFO/+917WZhOuglpb6YRteH3Lug//OW1e/NjbrvZM5VtieJ// vm/OR6HsSi8MJSY/qaoXsXKrjm6v6usut/5pspJ/pDZKmiFbOc8Okx9F8wg8KJJEFh/m nDIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=z+1ZVGdug029BKztuBflcFM502/rjs3mo1eYtrMifDk=; b=kxTaYwZ3LntMSJPcc6FJUGY+LfNrfyhemc+5xREc3uY72gkZTXt7ZhWVMhhM7pbrLI EAzep19qEC177pdrNTB+JD4tImThOXlLBG/iiQgURJmLMWVaard5qgfHR8QrR5tZBg9B yCdzFwQJqdDYyrBn2Zox15UiYtExLvRbdkEOn+fbZaa8gDPg7W6RTMyc9K6d4KxkAftz oYyt3qO1HCGEoIIxd3sq8RhKZHnf0QVr4M19JZ2t8fB5HftoMdz0IVTN3NbjCQdzyzSS 0hO16u/VJ3ys7SCR6RxMW9ioO2iTuK6Fb8LB3Hrlvygrw+c6/GpdX2wmNLdHNWYhY8pi lqBg== X-Gm-Message-State: AOAM533xe3SwiII1QqTzvy0qUe6D93qVa5m/LYyQ/WkxAFYqWGWphQk9 m0M9aITTiuKq8/yY8D9cH8sjeeDizOhncnZaArk= X-Google-Smtp-Source: ABdhPJz+bFqjk8VaBnBWuFFdFQPRqIUBKPTB9RbWFhRR+y+f3gJt5VIBShRoOFUv/tXM63FGpUHBOjlGJ6nvf3KArRs= X-Received: by 2002:a17:906:1f82:: with SMTP id t2mr16945837ejr.499.1627936752631; Mon, 02 Aug 2021 13:39:12 -0700 (PDT) MIME-Version: 1.0 References: <2862852d-badd-7486-3a8e-c5ea9666d6fb@google.com> <55526ab1-4280-9538-51d7-6669b8a97f@google.com> In-Reply-To: <55526ab1-4280-9538-51d7-6669b8a97f@google.com> From: Yang Shi Date: Mon, 2 Aug 2021 13:39:00 -0700 Message-ID: Subject: Re: [PATCH 04/16] huge tmpfs: revert shmem's use of transhuge_vma_enabled() To: Hugh Dickins Cc: 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 31, 2021 at 9:01 PM Hugh Dickins wrote: > > 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. Yes, I agree one checks vma the other one checks mm, they are different from this perspective. Anyway, as I said I have no objection to this change. You could add Reviewed-by: Yang Shi > > 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=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 A79F6C4338F for ; Mon, 2 Aug 2021 20:39:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 13222604D7 for ; Mon, 2 Aug 2021 20:39:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 13222604D7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 9891C6B0033; Mon, 2 Aug 2021 16:39:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 93A1A6B0036; Mon, 2 Aug 2021 16:39:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 828208D0001; Mon, 2 Aug 2021 16:39:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0050.hostedemail.com [216.40.44.50]) by kanga.kvack.org (Postfix) with ESMTP id 6D3E96B0033 for ; Mon, 2 Aug 2021 16:39:14 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 1D5CE20439 for ; Mon, 2 Aug 2021 20:39:14 +0000 (UTC) X-FDA: 78431305428.34.A2CEFDA Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) by imf14.hostedemail.com (Postfix) with ESMTP id B214160080B8 for ; Mon, 2 Aug 2021 20:39:13 +0000 (UTC) Received: by mail-ej1-f48.google.com with SMTP id oz16so32869373ejc.7 for ; Mon, 02 Aug 2021 13:39:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=z+1ZVGdug029BKztuBflcFM502/rjs3mo1eYtrMifDk=; b=WpqW6gbPXWmSXSnBXN8wuQVcUZ5E+920VtDCBI9sJOXAr5tN2Vf5zVNcGKewIC7PYJ 1gM06RAbNtITBSUxFkYEWFDPQsnfX3ekTklSXHkCXyK/p1X8Mk9fXWBdHarsIreOLC6l J+4ji/fyHzEfPW+YKKlN/ZKuW0fUwUeqdBWZSNtLgQAQRIfwvu2llBdvR/ZYKE/ceJAD RC/VI9WxFcMwJzOrdM/OFO/+917WZhOuglpb6YRteH3Lug//OW1e/NjbrvZM5VtieJ// vm/OR6HsSi8MJSY/qaoXsXKrjm6v6usut/5pspJ/pDZKmiFbOc8Okx9F8wg8KJJEFh/m nDIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=z+1ZVGdug029BKztuBflcFM502/rjs3mo1eYtrMifDk=; b=CsaDSyJnEG7ybT3TCDqUY2Cp8MFIiR4mvVJLCeboidu/WRZW3dCv9H5hG9xKmJRaPp NXgAtq/AW3NTEFjZvaTGQMYeq5S+KX1aDbpDm6S9uhFTO67vaW+3BtjBQKdffdEtRWzp qy4UY1/JuZADKkRUgaWKcEpSbCahHpmxspUwtHVwvFt4kNBhbAEcI6Vd0PlDSA+HPXNC XB/bvY81J8fDbmzovZiXNQUU7sqy9snHDCSTe48HbDVvzSjgxK4uj2WKD7Y/Hdg1TGge Bl+NK3Kq3huUenRLenIwX8VQVazC3HhAXyw0TmX2QaE9qYF5d4+Ol7/aVY5tskKLpamB kPdw== X-Gm-Message-State: AOAM5333kvoSOGkicDH27dypAfZWj/RtMgoDarCQFXAHXw5LHFmpcQfx xIZxrBRrvpE0EcB01RCh0k142I/lTQTpv+cEkRU= X-Google-Smtp-Source: ABdhPJz+bFqjk8VaBnBWuFFdFQPRqIUBKPTB9RbWFhRR+y+f3gJt5VIBShRoOFUv/tXM63FGpUHBOjlGJ6nvf3KArRs= X-Received: by 2002:a17:906:1f82:: with SMTP id t2mr16945837ejr.499.1627936752631; Mon, 02 Aug 2021 13:39:12 -0700 (PDT) MIME-Version: 1.0 References: <2862852d-badd-7486-3a8e-c5ea9666d6fb@google.com> <55526ab1-4280-9538-51d7-6669b8a97f@google.com> In-Reply-To: <55526ab1-4280-9538-51d7-6669b8a97f@google.com> From: Yang Shi Date: Mon, 2 Aug 2021 13:39:00 -0700 Message-ID: Subject: Re: [PATCH 04/16] huge tmpfs: revert shmem's use of transhuge_vma_enabled() To: Hugh Dickins Cc: 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 Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: B214160080B8 Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=WpqW6gbP; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf14.hostedemail.com: domain of shy828301@gmail.com designates 209.85.218.48 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-Stat-Signature: hpjksz59njpazjyg99ba3j8tfowhx4ei X-HE-Tag: 1627936753-610352 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 Sat, Jul 31, 2021 at 9:01 PM Hugh Dickins wrote: > > 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. Yes, I agree one checks vma the other one checks mm, they are different from this perspective. Anyway, as I said I have no objection to this change. You could add Reviewed-by: Yang Shi > > 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