From patchwork Tue Apr 13 21:24:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12201461 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FCADC433B4 for ; Tue, 13 Apr 2021 21:24:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C00FB61242 for ; Tue, 13 Apr 2021 21:24:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C00FB61242 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 610066B007D; Tue, 13 Apr 2021 17:24:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 56ECC6B007E; Tue, 13 Apr 2021 17:24:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C4126B0080; Tue, 13 Apr 2021 17:24:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0190.hostedemail.com [216.40.44.190]) by kanga.kvack.org (Postfix) with ESMTP id 208326B007D for ; Tue, 13 Apr 2021 17:24:45 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id CE9CA18036D77 for ; Tue, 13 Apr 2021 21:24:44 +0000 (UTC) X-FDA: 78028623288.23.E85B9FC Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf24.hostedemail.com (Postfix) with ESMTP id AA599A0003AF for ; Tue, 13 Apr 2021 21:24:38 +0000 (UTC) Received: by mail-pl1-f169.google.com with SMTP id h20so8948625plr.4 for ; Tue, 13 Apr 2021 14:24:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cvqUdonBPmk2kB4YQmzOfQMs+Xj3C2NnGl5E7POeuCY=; b=a7HJlLdPXf1Ie2ABAbT1fZb01nutSrYXrK/qw9DCVz8ySPMt/orx2o9v45UX+/GsGJ 9+c1FrvE21rBLQDcbm2CsgF95BEG3vUAoMTFqeFd76lG9GwE0je/Bt232Ci81FclqkUS O/mt92nq3yLV5l9asSY+bwhjw3VCRRL9tXBO+VhscJdAZLrGxHOc2d3n82CLAU3+NKKa 2klPeH4N/FbCZ+ve4uSQCzKDPO2X+Bn0hQTK+vOCcm9gtZKjiexMKbP5IXCkQBYlSk8q KW7Ckt2010QZN2LgFkRIWQSm/LtT8kUfLosckW6yz0YLhkbxOJpnsJK5LuQWvMrQRxC8 DASA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cvqUdonBPmk2kB4YQmzOfQMs+Xj3C2NnGl5E7POeuCY=; b=UyU634nAHWd9+BGmqUYjRkyNOf341BKXloErnzY/LnDI9PavCPHMaR3005YvXmoT9t 0y1sTdo3En2mbrtq3e2vlMan/8W13XNOX/7L7qLlG3KNBpiKNI2PcsjYpYH6qn3HIG8Q LI0IVfgOzUrg277GN2su988uh+WDccgwk1t51D3/r6HqFzrLuEARDat41u3cGXkhuep6 wx7+wKFf+ZeZJKTA8B9M/Rw5nsQKGQdqQQs3DlHXcDuETOTvmS5CrZurxw7UeLdDx5Dc TawZl/YuxWGcfcTC3FDK3tcNSynbglw36Lbf4aTsy9IIKWKAkBCErZhaAo4Z7TGbyuoe jYyg== X-Gm-Message-State: AOAM5316tYDe+5vxWjCalEpBWeAkH6e36GtdsFSb5c53sA87oqEM/Fjl s03kPSsRmOkRsePntV5q55s= X-Google-Smtp-Source: ABdhPJx5XohOwflczqaouWLBS/EIq7j+NpJVG76BrGTlOzkAJUP2+sOE/hBZBuiYoDLI2FUEsUe7Uw== X-Received: by 2002:a17:90a:bb0b:: with SMTP id u11mr2115705pjr.159.1618349083713; Tue, 13 Apr 2021 14:24:43 -0700 (PDT) Received: from localhost.localdomain (c-73-93-239-127.hsd1.ca.comcast.net. [73.93.239.127]) by smtp.gmail.com with ESMTPSA id fw24sm3069345pjb.21.2021.04.13.14.24.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 14:24:42 -0700 (PDT) From: Yang Shi To: mgorman@suse.de, kirill.shutemov@linux.intel.com, ziy@nvidia.com, mhocko@suse.com, ying.huang@intel.com, hughd@google.com, gerald.schaefer@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, borntraeger@de.ibm.com, akpm@linux-foundation.org Cc: shy828301@gmail.com, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [v2 PATCH 7/7] mm: thp: skip make PMD PROT_NONE if THP migration is not supported Date: Tue, 13 Apr 2021 14:24:16 -0700 Message-Id: <20210413212416.3273-8-shy828301@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210413212416.3273-1-shy828301@gmail.com> References: <20210413212416.3273-1-shy828301@gmail.com> MIME-Version: 1.0 X-Stat-Signature: wz43jzu38nmny6sixm53gz88otxr5t5u X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: AA599A0003AF Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf24; identity=mailfrom; envelope-from=""; helo=mail-pl1-f169.google.com; client-ip=209.85.214.169 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618349078-76217 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: A quick grep shows x86_64, PowerPC (book3s), ARM64 and S390 support both NUMA balancing and THP. But S390 doesn't support THP migration so NUMA balancing actually can't migrate any misplaced pages. Skip make PMD PROT_NONE for such case otherwise CPU cycles may be wasted by pointless NUMA hinting faults on S390. Signed-off-by: Yang Shi Acked-by: Mel Gorman --- mm/huge_memory.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 94981907fd4c..f63445f3a17d 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1741,6 +1741,7 @@ bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr, * Returns * - 0 if PMD could not be locked * - 1 if PMD was locked but protections unchanged and TLB flush unnecessary + * or if prot_numa but THP migration is not supported * - HPAGE_PMD_NR if protections changed and TLB flush necessary */ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, @@ -1755,6 +1756,9 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, bool uffd_wp = cp_flags & MM_CP_UFFD_WP; bool uffd_wp_resolve = cp_flags & MM_CP_UFFD_WP_RESOLVE; + if (prot_numa && !thp_migration_supported()) + return 1; + ptl = __pmd_trans_huge_lock(pmd, vma); if (!ptl) return 0;