Message ID | 20230315171642.1244625-1-peterx@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp36388wrt; Wed, 15 Mar 2023 10:56:16 -0700 (PDT) X-Google-Smtp-Source: AK7set+RzvOOI3pyWAMsUDbryeqAu3T97am/ljiAzTZrukMo869qMR42KMO6hqCokKmRLJ4ls1JL X-Received: by 2002:a05:6a20:2da4:b0:d5:a5d3:9577 with SMTP id bf36-20020a056a202da400b000d5a5d39577mr468285pzb.49.1678902976478; Wed, 15 Mar 2023 10:56:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678902976; cv=none; d=google.com; s=arc-20160816; b=Xn/n28a+gWwRpDtqI47YEBfOTFiMayNsZnEiv6668q7ooG+deJOMbColZSHWQdDwTy 4w6/u25/nfFyxFisF6P34jgpUzq06r+t2mbaoyjYx8U9tor+pgtaxOiSKyVQsvv+Ums1 r82A+OnmVVdWRzRJnM45IoKZAJgc0NFcHhQpf9AMSlR2fkqE9bY5zOXVVSvw0NcWbDHF 3oIwCRx3jKlRyg9KzcYSi3pkXsPiGJodw3RG/pU7xc/9KIAYpip42A8/SjXXeqVTl11B wgS1RV93pEKNNcE6BnIlLNDFkvyGeflEg0Ykh1TF093QtOwV0QGPrSzjMdjPXPTFWwN+ OJ+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=zvezbU1ptkdFZAvuDb0blk+QkhG0CCjoFIruzUfPyhk=; b=lbYlahbvRvrvNCbzzC6zoBBNLPXf6XNDOXQVdAHLmryxrL68qYpubR19DQOwrMdEP3 4rs72ypaDsiHNVW1GamGBsdlLvjmEDa3juhtiSdt+FnlA7YCX/BP0w3IJhSMtSmhR4PT B3mU3QiuHXoAI4fj3kGaPUNvkApKGXy5QVGhclcmrJCEfLKRjdlD2P3EzYpHhDIAQnet EabpZR73zGvUgbiiUvCvEQLGe0siefkhpVTNCrw9KfOYNi/XueMEdHwjCN7chyasAiKk chLU3mTE/Qb8vvtS684ioXzl5xWycyVcp1SkLocAlrUlh/LrPxKUI29vHZCCW7WnHXi6 l9gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OJ2Z0bs9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j191-20020a6380c8000000b004fbe9c0d3c8si5516388pgd.692.2023.03.15.10.56.00; Wed, 15 Mar 2023 10:56:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OJ2Z0bs9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232031AbjCORRg (ORCPT <rfc822;ruipengqi7@gmail.com> + 99 others); Wed, 15 Mar 2023 13:17:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231194AbjCORRf (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 15 Mar 2023 13:17:35 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3797685B28 for <linux-kernel@vger.kernel.org>; Wed, 15 Mar 2023 10:16:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678900607; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=zvezbU1ptkdFZAvuDb0blk+QkhG0CCjoFIruzUfPyhk=; b=OJ2Z0bs9vHAAZ77ikwrTUxrjhZqbnIt7PmT5+XrPo4PiX7vUA1hLM9gGYi06w9Ry05zXpQ 2rgCWS7DqiZ9mVUFqvMRSFx36p0dqk6dkdU7CHI46AjzXLMp6Nud1p+/QMxoPzXFmf7ppr 6qqLN6Qw9s50p69J5SSFZdnWunXS+W8= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-306-ONWlgepKPtSPe9P08OrRGQ-1; Wed, 15 Mar 2023 13:16:46 -0400 X-MC-Unique: ONWlgepKPtSPe9P08OrRGQ-1 Received: by mail-qv1-f71.google.com with SMTP id l18-20020ad44bd2000000b005a9cf5f609eso5784368qvw.15 for <linux-kernel@vger.kernel.org>; Wed, 15 Mar 2023 10:16:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678900605; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zvezbU1ptkdFZAvuDb0blk+QkhG0CCjoFIruzUfPyhk=; b=X7NNeED58uE5QS5mws90mMsUAD5obU5k7Ucg4K48Rx/CpmCHFyORlhTrHxkQhPUbaj O1iwavDzAK+qhEI2sGByemxNB0UpF4kSbWW0XVTPUi+x+WeEncQIo5w1JiRFuQhpIecK 5HgxGMwUsO3ILNNYa5qniGCDBd05k2B+js2JnkzlbRrUYVbdjsk9NYYKh8kdHZYjd96a GSQobsWgSHYsF0M/feVUQeB6O7zXvZQrS74xzWzjysACtAkCHH62cJz9lf0D1ymULWhm E5ZyszecQ8/KPF1jwcb0Iq/Z2a1rBQmaWFk6T0YbDA1g11dtQm09o27fTKHcL0lXJMP0 lGyQ== X-Gm-Message-State: AO0yUKUMNMwCtqG7W6RUu+dYWkTx2Of11wp4bAY+uJEgMsZ8xmebcNhQ ZJXX/MKmaROf+z9BLjfqQfmFtpcEx2Hemn8aH8YO59okVAss9OLY4h1zUJj8crJpv8IZfzplRa6 P8PsOGQ8PNqLcb/G0wO88A0j45hxw9RSrIyrcSANSjeenXO/g9u3KiiwF7iuszaQNUwYgWRd2XN CAKZ9X0A== X-Received: by 2002:a05:6214:1c84:b0:56c:d9e:c9a0 with SMTP id ib4-20020a0562141c8400b0056c0d9ec9a0mr34426352qvb.1.1678900605200; Wed, 15 Mar 2023 10:16:45 -0700 (PDT) X-Received: by 2002:a05:6214:1c84:b0:56c:d9e:c9a0 with SMTP id ib4-20020a0562141c8400b0056c0d9ec9a0mr34426317qvb.1.1678900604835; Wed, 15 Mar 2023 10:16:44 -0700 (PDT) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-56-70-30-145-63.dsl.bell.ca. [70.30.145.63]) by smtp.gmail.com with ESMTPSA id 198-20020a370acf000000b007424376ca4bsm4065432qkk.18.2023.03.15.10.16.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 10:16:44 -0700 (PDT) From: Peter Xu <peterx@redhat.com> To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Andrew Morton <akpm@linux-foundation.org>, peterx@redhat.com, "Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>, Yang Shi <shy828301@gmail.com> Subject: [PATCH] mm/thp: Rename TRANSPARENT_HUGEPAGE_NEVER_DAX to _UNSUPPORTED Date: Wed, 15 Mar 2023 13:16:42 -0400 Message-Id: <20230315171642.1244625-1-peterx@redhat.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760457367225248452?= X-GMAIL-MSGID: =?utf-8?q?1760457367225248452?= |
Series |
mm/thp: Rename TRANSPARENT_HUGEPAGE_NEVER_DAX to _UNSUPPORTED
|
|
Commit Message
Peter Xu
March 15, 2023, 5:16 p.m. UTC
TRANSPARENT_HUGEPAGE_NEVER_DAX has nothing to do with DAX. It's set when
has_transparent_hugepage() returns false, checked in hugepage_vma_check()
and will disable THP completely if false. Rename it to reflect its real
purpose.
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Yang Shi <shy828301@gmail.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
include/linux/huge_mm.h | 2 +-
mm/huge_memory.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
Comments
On Wed, Mar 15, 2023 at 10:16 AM Peter Xu <peterx@redhat.com> wrote: > > TRANSPARENT_HUGEPAGE_NEVER_DAX has nothing to do with DAX. It's set when > has_transparent_hugepage() returns false, checked in hugepage_vma_check() > and will disable THP completely if false. Rename it to reflect its real > purpose. Makes sense to me. Reviewed-by: Yang Shi <shy828301@gmail.com> > > Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> > Cc: Yang Shi <shy828301@gmail.com> > Signed-off-by: Peter Xu <peterx@redhat.com> > --- > include/linux/huge_mm.h | 2 +- > mm/huge_memory.c | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h > index 70bd867eba94..9a3a3af2dd80 100644 > --- a/include/linux/huge_mm.h > +++ b/include/linux/huge_mm.h > @@ -79,7 +79,7 @@ static inline vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, > } > > enum transparent_hugepage_flag { > - TRANSPARENT_HUGEPAGE_NEVER_DAX, > + TRANSPARENT_HUGEPAGE_UNSUPPORTED, > TRANSPARENT_HUGEPAGE_FLAG, > TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, > TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG, > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index b0ab247939e0..913e7dc32869 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -88,7 +88,7 @@ bool hugepage_vma_check(struct vm_area_struct *vma, unsigned long vm_flags, > /* > * If the hardware/firmware marked hugepage support disabled. > */ > - if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_NEVER_DAX)) > + if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_UNSUPPORTED)) > return false; > > /* khugepaged doesn't collapse DAX vma, but page fault is fine. */ > @@ -464,7 +464,7 @@ static int __init hugepage_init(void) > * Hardware doesn't support hugepages, hence disable > * DAX PMD support. > */ > - transparent_hugepage_flags = 1 << TRANSPARENT_HUGEPAGE_NEVER_DAX; > + transparent_hugepage_flags = 1 << TRANSPARENT_HUGEPAGE_UNSUPPORTED; > return -EINVAL; > } > > -- > 2.39.1 >
On 15.03.23 18:16, Peter Xu wrote: > TRANSPARENT_HUGEPAGE_NEVER_DAX has nothing to do with DAX. It's set when > has_transparent_hugepage() returns false, checked in hugepage_vma_check() > and will disable THP completely if false. Rename it to reflect its real > purpose. > > Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> > Cc: Yang Shi <shy828301@gmail.com> > Signed-off-by: Peter Xu <peterx@redhat.com> > --- > include/linux/huge_mm.h | 2 +- > mm/huge_memory.c | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h > index 70bd867eba94..9a3a3af2dd80 100644 > --- a/include/linux/huge_mm.h > +++ b/include/linux/huge_mm.h > @@ -79,7 +79,7 @@ static inline vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, > } > > enum transparent_hugepage_flag { > - TRANSPARENT_HUGEPAGE_NEVER_DAX, > + TRANSPARENT_HUGEPAGE_UNSUPPORTED, > TRANSPARENT_HUGEPAGE_FLAG, > TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, > TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG, > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index b0ab247939e0..913e7dc32869 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -88,7 +88,7 @@ bool hugepage_vma_check(struct vm_area_struct *vma, unsigned long vm_flags, > /* > * If the hardware/firmware marked hugepage support disabled. > */ > - if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_NEVER_DAX)) > + if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_UNSUPPORTED)) > return false; > > /* khugepaged doesn't collapse DAX vma, but page fault is fine. */ > @@ -464,7 +464,7 @@ static int __init hugepage_init(void) > * Hardware doesn't support hugepages, hence disable > * DAX PMD support. We should also fixup that comment then, no? Acked-by: David Hildenbrand <david@redhat.com>
On Thu, Mar 16, 2023 at 03:57:12PM +0100, David Hildenbrand wrote: > On 15.03.23 18:16, Peter Xu wrote: > > TRANSPARENT_HUGEPAGE_NEVER_DAX has nothing to do with DAX. It's set when > > has_transparent_hugepage() returns false, checked in hugepage_vma_check() > > and will disable THP completely if false. Rename it to reflect its real > > purpose. > > > > Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> > > Cc: Yang Shi <shy828301@gmail.com> > > Signed-off-by: Peter Xu <peterx@redhat.com> > > --- > > include/linux/huge_mm.h | 2 +- > > mm/huge_memory.c | 4 ++-- > > 2 files changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h > > index 70bd867eba94..9a3a3af2dd80 100644 > > --- a/include/linux/huge_mm.h > > +++ b/include/linux/huge_mm.h > > @@ -79,7 +79,7 @@ static inline vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, > > } > > enum transparent_hugepage_flag { > > - TRANSPARENT_HUGEPAGE_NEVER_DAX, > > + TRANSPARENT_HUGEPAGE_UNSUPPORTED, > > TRANSPARENT_HUGEPAGE_FLAG, > > TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, > > TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG, > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > > index b0ab247939e0..913e7dc32869 100644 > > --- a/mm/huge_memory.c > > +++ b/mm/huge_memory.c > > @@ -88,7 +88,7 @@ bool hugepage_vma_check(struct vm_area_struct *vma, unsigned long vm_flags, > > /* > > * If the hardware/firmware marked hugepage support disabled. > > */ > > - if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_NEVER_DAX)) > > + if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_UNSUPPORTED)) > > return false; > > /* khugepaged doesn't collapse DAX vma, but page fault is fine. */ > > @@ -464,7 +464,7 @@ static int __init hugepage_init(void) > > * Hardware doesn't support hugepages, hence disable > > * DAX PMD support. > > > We should also fixup that comment then, no? Yes, I'd drop the comment since the code explains itself. One fixup attached. Thanks.
On 16.03.23 16:18, Peter Xu wrote: > On Thu, Mar 16, 2023 at 03:57:12PM +0100, David Hildenbrand wrote: >> On 15.03.23 18:16, Peter Xu wrote: >>> TRANSPARENT_HUGEPAGE_NEVER_DAX has nothing to do with DAX. It's set when >>> has_transparent_hugepage() returns false, checked in hugepage_vma_check() >>> and will disable THP completely if false. Rename it to reflect its real >>> purpose. >>> >>> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> >>> Cc: Yang Shi <shy828301@gmail.com> >>> Signed-off-by: Peter Xu <peterx@redhat.com> >>> --- >>> include/linux/huge_mm.h | 2 +- >>> mm/huge_memory.c | 4 ++-- >>> 2 files changed, 3 insertions(+), 3 deletions(-) >>> >>> diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h >>> index 70bd867eba94..9a3a3af2dd80 100644 >>> --- a/include/linux/huge_mm.h >>> +++ b/include/linux/huge_mm.h >>> @@ -79,7 +79,7 @@ static inline vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, >>> } >>> enum transparent_hugepage_flag { >>> - TRANSPARENT_HUGEPAGE_NEVER_DAX, >>> + TRANSPARENT_HUGEPAGE_UNSUPPORTED, >>> TRANSPARENT_HUGEPAGE_FLAG, >>> TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, >>> TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG, >>> diff --git a/mm/huge_memory.c b/mm/huge_memory.c >>> index b0ab247939e0..913e7dc32869 100644 >>> --- a/mm/huge_memory.c >>> +++ b/mm/huge_memory.c >>> @@ -88,7 +88,7 @@ bool hugepage_vma_check(struct vm_area_struct *vma, unsigned long vm_flags, >>> /* >>> * If the hardware/firmware marked hugepage support disabled. >>> */ >>> - if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_NEVER_DAX)) >>> + if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_UNSUPPORTED)) >>> return false; >>> /* khugepaged doesn't collapse DAX vma, but page fault is fine. */ >>> @@ -464,7 +464,7 @@ static int __init hugepage_init(void) >>> * Hardware doesn't support hugepages, hence disable >>> * DAX PMD support. >> >> >> We should also fixup that comment then, no? > > Yes, I'd drop the comment since the code explains itself. One fixup > attached. Thanks. LGTM
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 70bd867eba94..9a3a3af2dd80 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -79,7 +79,7 @@ static inline vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, } enum transparent_hugepage_flag { - TRANSPARENT_HUGEPAGE_NEVER_DAX, + TRANSPARENT_HUGEPAGE_UNSUPPORTED, TRANSPARENT_HUGEPAGE_FLAG, TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG, diff --git a/mm/huge_memory.c b/mm/huge_memory.c index b0ab247939e0..913e7dc32869 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -88,7 +88,7 @@ bool hugepage_vma_check(struct vm_area_struct *vma, unsigned long vm_flags, /* * If the hardware/firmware marked hugepage support disabled. */ - if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_NEVER_DAX)) + if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_UNSUPPORTED)) return false; /* khugepaged doesn't collapse DAX vma, but page fault is fine. */ @@ -464,7 +464,7 @@ static int __init hugepage_init(void) * Hardware doesn't support hugepages, hence disable * DAX PMD support. */ - transparent_hugepage_flags = 1 << TRANSPARENT_HUGEPAGE_NEVER_DAX; + transparent_hugepage_flags = 1 << TRANSPARENT_HUGEPAGE_UNSUPPORTED; return -EINVAL; }