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 5F3D8CCA47D for ; Wed, 15 Jun 2022 20:26:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343819AbiFOU0t (ORCPT ); Wed, 15 Jun 2022 16:26:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245053AbiFOU0q (ORCPT ); Wed, 15 Jun 2022 16:26:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0F1354690 for ; Wed, 15 Jun 2022 13:26:37 -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 327D7615C1 for ; Wed, 15 Jun 2022 20:26:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D42AC3411E; Wed, 15 Jun 2022 20:26:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1655324796; bh=M9XDmtJtX7XcEMQDvDrkLNQgMRhMFyr5Dgx7Qipkq5I=; h=Date:To:From:Subject:From; b=eBVUPv7xDQwQV6u3ttbNcYGaNoL2CjhYD1MsT5PVvwQsdOz53Y0YT2ecHd7U/D8Oz jQ4YKa9T/K9v0VTuC8AXjdqkAqU1soS92yKgLkzg1OTvDs4USXHVyv5DRluX3M5qIi /eDROhso0qihzXlKwNENWV0xrSRpuloFEc4X6wT8= Date: Wed, 15 Jun 2022 13:26:35 -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: <20220615202636.7D42AC3411E@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: Wed, 15 Jun 2022 10:29:25 -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/20220615172926.546974-7-shy828301@gmail.com Signed-off-by: Yang Shi Cc: Kirill A. Shutemov Cc: Matthew Wilcox Cc: Miaohe Lin Cc: Vlastimil Babka Cc: Zach O'Keefe 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<