From patchwork Thu Jun 2 18:21:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12868042 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71544C433EF for ; Thu, 2 Jun 2022 18:22:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A15E6B0073; Thu, 2 Jun 2022 14:22:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0066A6B0074; Thu, 2 Jun 2022 14:22:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DBD286B0075; Thu, 2 Jun 2022 14:22:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id CDFE36B0073 for ; Thu, 2 Jun 2022 14:22:06 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 9CECA813E2 for ; Thu, 2 Jun 2022 18:22:06 +0000 (UTC) X-FDA: 79534115052.16.24204AF Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf02.hostedemail.com (Postfix) with ESMTP id 795A680076 for ; Thu, 2 Jun 2022 18:22:00 +0000 (UTC) Received: by mail-pl1-f172.google.com with SMTP id q18so5139162pln.12 for ; Thu, 02 Jun 2022 11:22:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SWErXY/21cRT+JuPcizRjGDN5I2BQSMNvqCbtDuuEgI=; b=OoXAfZEZ4MNYzgwa1mxiiNLYILQhuzvKYToutAR1jjUYvKsN/qDaq0gORFJAw9/cMc Swt3hbAIAH81YoqZPRe0tQShdki9kmu9D8ux7uQVtefn1LynwDEYYY4W7FQXp9cZiw6z RbDJFDdvFyH8GP+u4N4gMypVi6x6+gxi0ewd3+HgSj8ymzFH8MzRlbC/kzV13iEMGwmH Lp8clnYaxcOFH1CqANZ7k/LKzCNXs1qiY+fd9Yu1zJ1EjGGrcosgC5Xzvp2gBS0EHOpE 5JOBXFQqT2zKdvyP2JZh6k9aG87muIeU40osHXul4peFUx4vhf4iBwzGpqaX2iKMR8AS Nraw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SWErXY/21cRT+JuPcizRjGDN5I2BQSMNvqCbtDuuEgI=; b=ZlCW/ywRhKK1TBpgdx7kyvkn+auPwGsQe8E0hrOO7HDTg3wLlZxmDM3DUFR9WSpzcv JXVZuXej4WgcUoMUXqOQQ80U2aQ3L2cMBiJW6d24XYaJ27Pp143IRX7Q5CpuSwNLUzPZ sHlrrJQsF2O/C+PHLPvHnBeVw9uEDl9Nvrr74GtSP0rOdS8mNE6NxIlqVeqPbW2f6/Io 35Lt4JDlLDaQQKCWBjwuFs/NXAiEJZE4JqUcR8kve6bBl6xurjhO2s0uRx1oTmdTbCDx ycvzRpX1UI4CFQovPag7z4RXY+b27aDsn/55+r2C2nOFgtjTAeU4Mp9RdGurKbCfJjsH H1qw== X-Gm-Message-State: AOAM532ywzSomiq2YyPjfDbvvl0kEW+PAfxF2jBMJJOb0rdZPiAp149j h3CDXs0vWKKhzAxCD6d7eD0= X-Google-Smtp-Source: ABdhPJzC7OcR42WCXQLvw7aP2hx+qZcdKxnU7F7jgc1gw7m3PVF8cbDihuLNflGU/XhxlYAkH0vxSQ== X-Received: by 2002:a17:903:1108:b0:156:73a7:7c1 with SMTP id n8-20020a170903110800b0015673a707c1mr6113799plh.101.1654194125146; Thu, 02 Jun 2022 11:22:05 -0700 (PDT) Received: from localhost.localdomain (c-67-174-241-145.hsd1.ca.comcast.net. [67.174.241.145]) by smtp.gmail.com with ESMTPSA id t10-20020a1709027fca00b0015f2d549b46sm3866779plb.237.2022.06.02.11.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jun 2022 11:22:04 -0700 (PDT) From: Yang Shi To: vbabka@suse.cz, kirill.shutemov@linux.intel.com, akpm@linux-foundation.org Cc: shy828301@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [v2 PATCH 1/7] mm: khugepaged: check THP flag in hugepage_vma_check() Date: Thu, 2 Jun 2022 11:21:53 -0700 Message-Id: <20220602182159.248387-2-shy828301@gmail.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20220602182159.248387-1-shy828301@gmail.com> References: <20220602182159.248387-1-shy828301@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 795A680076 X-Stat-Signature: 8tc83z1aye3nqfaaa5fcqikqecnte1j6 Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=OoXAfZEZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.hostedemail.com: domain of shy828301@gmail.com designates 209.85.214.172 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-HE-Tag: 1654194120-515004 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: Currently the THP flag check in hugepage_vma_check() will fallthrough if the flag is NEVER and VM_HUGEPAGE is set. This is not a problem for now since all the callers have the flag checked before or can't be invoked if the flag is NEVER. However, the following patch will call hugepage_vma_check() in more places, for example, page fault, so this flag must be checked in hugepge_vma_check(). Signed-off-by: Yang Shi --- mm/khugepaged.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 671ac7800e53..84b9cf4b9be9 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -458,6 +458,9 @@ bool hugepage_vma_check(struct vm_area_struct *vma, if (shmem_file(vma->vm_file)) return shmem_huge_enabled(vma); + if (!khugepaged_enabled()) + return false; + /* THP settings require madvise. */ if (!(vm_flags & VM_HUGEPAGE) && !khugepaged_always()) return false;