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 20106CCA47A for ; Thu, 16 Jun 2022 18:23:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231732AbiFPSX3 (ORCPT ); Thu, 16 Jun 2022 14:23:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377464AbiFPSXU (ORCPT ); Thu, 16 Jun 2022 14:23:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF77E4B1EF for ; Thu, 16 Jun 2022 11:23:19 -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 ams.source.kernel.org (Postfix) with ESMTPS id 70085B82594 for ; Thu, 16 Jun 2022 18:23:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DF2CC3411A; Thu, 16 Jun 2022 18:23:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1655403797; bh=6ov5Bx0zZYN9mbmL1xEL2HjTpalA/8dZv0mRBHuvZek=; h=Date:To:From:Subject:From; b=OoDUUqii2Zw5oOyeaH5l0Rzp2viqkT7l2uU2KnFpYW8VtN5WJRcBTV3OTRabzbEWj 5HBqZcs34yTMAWCMqFt9QQ1yELa/OHgOqhRGnPpjncGbh7t1aI+SRLnWwd3CIaWgYp JZ/K8amgtXa95LR0UrIstJgKZGFaA7Kz0hHB5m64= Date: Thu, 16 Jun 2022 11:23:16 -0700 To: mm-commits@vger.kernel.org, zokeefe@google.com, willy@infradead.org, vbabka@suse.cz, linmiaohe@huawei.com, kirill.shutemov@linux.intel.com, shy828301@gmail.com, akpm@linux-foundation.org From: Andrew Morton Subject: + mm-khugepaged-reorg-some-khugepaged-helpers.patch added to mm-unstable branch Message-Id: <20220616182317.0DF2CC3411A@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: reorg some khugepaged helpers has been added to the -mm mm-unstable branch. Its filename is mm-khugepaged-reorg-some-khugepaged-helpers.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-khugepaged-reorg-some-khugepaged-helpers.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm 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 via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Yang Shi Subject: mm: khugepaged: reorg some khugepaged helpers Date: Thu, 16 Jun 2022 10:48:39 -0700 The khugepaged_{enabled|always|req_madv} are not khugepaged only anymore, move them to huge_mm.h and rename to hugepage_flags_xxx, and remove khugepaged_req_madv due to no users. Also move khugepaged_defrag to khugepaged.c since its only caller is in that file, it doesn't have to be in a header file. Link: https://lkml.kernel.org/r/20220616174840.1202070-7-shy828301@gmail.com Signed-off-by: Yang Shi Reviewed-by: Zach O'Keefe Cc: Kirill A. Shutemov Cc: Matthew Wilcox Cc: Miaohe Lin Cc: Vlastimil Babka Signed-off-by: Andrew Morton --- include/linux/huge_mm.h | 8 ++++++++ include/linux/khugepaged.h | 14 -------------- mm/huge_memory.c | 4 ++-- mm/khugepaged.c | 18 +++++++++++------- 4 files changed, 21 insertions(+), 23 deletions(-) --- a/include/linux/huge_mm.h~mm-khugepaged-reorg-some-khugepaged-helpers +++ a/include/linux/huge_mm.h @@ -116,6 +116,14 @@ extern struct kobj_attribute shmem_enabl extern unsigned long transparent_hugepage_flags; +#define hugepage_flags_enabled() \ + (transparent_hugepage_flags & \ + ((1<flags)) --- a/mm/huge_memory.c~mm-khugepaged-reorg-some-khugepaged-helpers +++ a/mm/huge_memory.c @@ -117,11 +117,11 @@ bool hugepage_vma_check(struct vm_area_s if (!in_pf && shmem_file(vma->vm_file)) return shmem_huge_enabled(vma); - if (!khugepaged_enabled()) + if (!hugepage_flags_enabled()) return false; /* THP settings require madvise. */ - if (!(vm_flags & VM_HUGEPAGE) && !khugepaged_always()) + if (!(vm_flags & VM_HUGEPAGE) && !hugepage_flags_always()) return false; /* Only regular file is valid */ --- a/mm/khugepaged.c~mm-khugepaged-reorg-some-khugepaged-helpers +++ a/mm/khugepaged.c @@ -465,7 +465,7 @@ void khugepaged_enter_vma(struct vm_area unsigned long vm_flags) { if (!test_bit(MMF_VM_HUGEPAGE, &vma->vm_mm->flags) && - khugepaged_enabled()) { + hugepage_flags_enabled()) { if (hugepage_vma_check(vma, vm_flags, false, false)) __khugepaged_enter(vma->vm_mm); } @@ -757,6 +757,10 @@ static bool khugepaged_scan_abort(int ni return false; } +#define khugepaged_defrag() \ + (transparent_hugepage_flags & \ + (1<