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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CE4AC433F5 for ; Mon, 4 Apr 2022 23:38:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229496AbiDDXk0 (ORCPT ); Mon, 4 Apr 2022 19:40:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229611AbiDDXkW (ORCPT ); Mon, 4 Apr 2022 19:40:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FC8D63386 for ; Mon, 4 Apr 2022 16:38:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A045A6175F for ; Mon, 4 Apr 2022 23:38:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E98A9C340F3; Mon, 4 Apr 2022 23:38:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1649115481; bh=EIofUPJfgA1GKYbq2+kwRzC+ZgBTvn5jBv+MZJT9kGs=; h=Date:To:From:Subject:From; b=eNERLcNmp2Q2fX5uZ4ppfSE/yhqWTb5HDPInGtRt28LMCqTDR9RtkNmVwayfkXtXR NyPXtVHRl25hwH7xtV6w1Jk3nGkvYV/qZ436r10TGe+Z7DHQ20dzy5LZfyOKE2VGjy FLQt0A3eWyvfIQWK3ucA6CrEa1e+r0eJlFESEQs4= Date: Mon, 04 Apr 2022 16:38:00 -0700 To: mm-commits@vger.kernel.org, ziy@nvidia.com, willy@infradead.org, vbabka@suse.cz, tytso@mit.edu, song@kernel.org, riel@surriel.com, linmiaohe@huawei.com, kirill.shutemov@linux.intel.com, shy828301@gmail.com, akpm@linux-foundation.org From: Andrew Morton Subject: + mm-khugepaged-remove-redundant-check-for-vm_no_khugepaged.patch added to -mm tree Message-Id: <20220404233800.E98A9C340F3@smtp.kernel.org> Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The patch titled Subject: mm: khugepaged: remove redundant check for VM_NO_KHUGEPAGED has been added to the -mm tree. Its filename is mm-khugepaged-remove-redundant-check-for-vm_no_khugepaged.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-khugepaged-remove-redundant-check-for-vm_no_khugepaged.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-khugepaged-remove-redundant-check-for-vm_no_khugepaged.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Yang Shi Subject: mm: khugepaged: remove redundant check for VM_NO_KHUGEPAGED The hugepage_vma_check() called by khugepaged_enter_vma_merge() does check VM_NO_KHUGEPAGED. Remove the check from caller and move the check in hugepage_vma_check() up. More checks may be run for VM_NO_KHUGEPAGED vmas, but MADV_HUGEPAGE is definitely not a hot path, so cleaner code does outweigh. Link: https://lkml.kernel.org/r/20220404200250.321455-3-shy828301@gmail.com Signed-off-by: Yang Shi Reviewed-by: Miaohe Lin Acked-by: Song Liu Cc: "Kirill A. Shutemov" Cc: Matthew Wilcox Cc: Rik van Riel Cc: Theodore Ts'o Cc: Vlastimil Babka Cc: Zi Yan Signed-off-by: Andrew Morton --- mm/khugepaged.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/mm/khugepaged.c~mm-khugepaged-remove-redundant-check-for-vm_no_khugepaged +++ a/mm/khugepaged.c @@ -365,8 +365,7 @@ int hugepage_madvise(struct vm_area_stru * register it here without waiting a page fault that * may not happen any time soon. */ - if (!(*vm_flags & VM_NO_KHUGEPAGED) && - khugepaged_enter_vma_merge(vma, *vm_flags)) + if (khugepaged_enter_vma_merge(vma, *vm_flags)) return -ENOMEM; break; case MADV_NOHUGEPAGE: @@ -445,6 +444,9 @@ static bool hugepage_vma_check(struct vm if (!transhuge_vma_enabled(vma, vm_flags)) return false; + if (vm_flags & VM_NO_KHUGEPAGED) + return false; + if (vma->vm_file && !IS_ALIGNED((vma->vm_start >> PAGE_SHIFT) - vma->vm_pgoff, HPAGE_PMD_NR)) return false; @@ -470,7 +472,8 @@ static bool hugepage_vma_check(struct vm return false; if (vma_is_temporary_stack(vma)) return false; - return !(vm_flags & VM_NO_KHUGEPAGED); + + return true; } int __khugepaged_enter(struct mm_struct *mm) _ Patches currently in -mm which might be from shy828301@gmail.com are sched-coredumph-clarify-the-use-of-mmf_vm_hugepage.patch mm-khugepaged-remove-redundant-check-for-vm_no_khugepaged.patch mm-khugepaged-skip-dax-vma.patch mm-thp-only-regular-file-could-be-thp-eligible.patch mm-khugepaged-make-khugepaged_enter-void-function.patch mm-khugepaged-move-some-khugepaged_-functions-to-khugepagedc.patch mm-khugepaged-introduce-khugepaged_enter_vma-helper.patch mm-mmap-register-suitable-readonly-file-vmas-for-khugepaged.patch