From patchwork Tue Sep 13 19:54:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Berger X-Patchwork-Id: 12975314 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 63753C6FA82 for ; Tue, 13 Sep 2022 19:58:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F2FA66B0081; Tue, 13 Sep 2022 15:58:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EB71C6B0082; Tue, 13 Sep 2022 15:58:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D584C8D0001; Tue, 13 Sep 2022 15:58:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C661E6B0081 for ; Tue, 13 Sep 2022 15:58:17 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A96C11401D4 for ; Tue, 13 Sep 2022 19:58:17 +0000 (UTC) X-FDA: 79908123834.06.4FE241F Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) by imf06.hostedemail.com (Postfix) with ESMTP id 782F418008B for ; Tue, 13 Sep 2022 19:58:17 +0000 (UTC) Received: by mail-qk1-f180.google.com with SMTP id f13so5069451qkk.6 for ; Tue, 13 Sep 2022 12:58:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=5478I3WyUfDJcI1zhJnzCnFwBV1ia1XR+sLHu3XJI6Q=; b=ngWpsEYVUBqyRCK+w+5Ame50HZp1DYM8gstxDexc5gHtIO2fEu4wX/+7Noqq7EWBX5 SX4JOXX5B1E8Qf1s/pvzk9Bz2iJJBgv4Hk3Ull+tKjmtldfM+s3z+vbM1B3di5w6gxjz dcVCWO2NZ50adOCK8bPYxw3tCqWOsDx7M7cTAjTnYf/V4tSaPDhi8fqtVljCEiP5o1JE EBkXOKZZNuxNzz6s5U3pOqHYezTLOaL4mQLClkKUJN8hT0raCVH32ZKrxQcROVGentqi 38kFA0gMphAG/6qqKzQ2VCttdNXcqVd0gmzjLhB0hmlMfPBCKPcE2Rytw17lBrFXHH3/ rqCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=5478I3WyUfDJcI1zhJnzCnFwBV1ia1XR+sLHu3XJI6Q=; b=vGDuEGP6cxHWWxquPSbypBLZc6YTtchKGqzbAEiMaDKhhuTpNN/ayK/XhMZkJJelp5 C3N9ts4nTZ6J+fQqJ9DWqEFI+fXFSWvwJHZx/IfBR7LoRiaHq1Ru5Z2RpG3eU3jlUXWx ovXqjApQilsd1lWGP6LQyG80TkanvXBMIK/tXhF89jGzHSPHlscC0PmUro0Q3th8hmcF Z5QRPDVzhviAvuOlqj99RPZxNS3hiSV4JFNH2ancCSDZdEa7qJ1fYsz6F0i1qzq9Cpf1 NDsulMIShzbbQ9u2g5yojSxIHXKQNPhf0GkrVJr7/Y9jgLIWBj5HW3jbj9exFFvQLNut JQ4Q== X-Gm-Message-State: ACgBeo02T8VX2C7CJh5sfwPHh/fTVz4HPUw3sWacF18ub1ED4QGPyWCG qlqNKj16toAEQVNSstpLZ2I= X-Google-Smtp-Source: AA6agR5yg7LQIQNFFYJ0sDmMy6v2CLDWuXatdLv4m+yPVXKNj8MYR/nHEcTFAbCbbhbRcvfawH5dww== X-Received: by 2002:a05:620a:4496:b0:6bb:8db4:6b49 with SMTP id x22-20020a05620a449600b006bb8db46b49mr24594751qkp.703.1663099096778; Tue, 13 Sep 2022 12:58:16 -0700 (PDT) Received: from stbirv-lnx-3.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id s11-20020a05620a29cb00b006b8e049cf08sm276305qkp.2.2022.09.13.12.58.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Sep 2022 12:58:16 -0700 (PDT) From: Doug Berger To: Andrew Morton Cc: Jonathan Corbet , Rob Herring , Krzysztof Kozlowski , Frank Rowand , Mike Kravetz , Muchun Song , Mike Rapoport , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Borislav Petkov , "Paul E. McKenney" , Neeraj Upadhyay , Randy Dunlap , Damien Le Moal , Doug Berger , Florian Fainelli , David Hildenbrand , Zi Yan , Oscar Salvador , Hari Bathini , Kees Cook , - , KOSAKI Motohiro , Mel Gorman , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux.dev Subject: [PATCH 06/21] mm/hugetlb: add hugepage isolation support Date: Tue, 13 Sep 2022 12:54:53 -0700 Message-Id: <20220913195508.3511038-7-opendmb@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220913195508.3511038-1-opendmb@gmail.com> References: <20220913195508.3511038-1-opendmb@gmail.com> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663099097; a=rsa-sha256; cv=none; b=AQqXZvBYqY9lMeziz442TGwMvV2EdklmzZ4B3a6+6ptSJ2vuGfkbS+39E3H8JPRnid0Eit KnmXP8GkjFmNBpdGfjsV/39CMmiewMGKBWh8zDqBCFMsqUYl9YkFY94qMTeijmH9KkMp9w r313vJJ7ByPTUr3b7pQJG4UM7VVgst4= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ngWpsEYV; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf06.hostedemail.com: domain of opendmb@gmail.com designates 209.85.222.180 as permitted sender) smtp.mailfrom=opendmb@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663099097; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5478I3WyUfDJcI1zhJnzCnFwBV1ia1XR+sLHu3XJI6Q=; b=FWG04cdfVILDQbZS1Rb+uKzMBL40Dq8Uyz6njh0gyuIpNCI/X9v9WfrEvrYHmbcMMzMvZA j2vSDcp+ZfeS8CrRS+VokAwrumSzlMRjrFcS9I2B/znp2kkgQ6jY79kvG7cdWZTQArI6kQ vKF75Kd76HGYNpSxOjeqrCACJoEKMxc= X-Rspam-User: Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ngWpsEYV; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf06.hostedemail.com: domain of opendmb@gmail.com designates 209.85.222.180 as permitted sender) smtp.mailfrom=opendmb@gmail.com X-Rspamd-Server: rspam11 X-Stat-Signature: shma7tg86g8dt4gdbfjgtifp839qesge X-Rspamd-Queue-Id: 782F418008B X-HE-Tag: 1663099097-504124 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: When a range of pageblocks is isolated there is at most one hugepage that has only tail pages overlapping that range (i.e. a hugepage that overlaps the beginning of the range). However, that hugepage is the first migration target for an alloc_contig_range() attempt so it already receives special attention. Checking whether the pageblock containing the head of a hugepage is isolated is an inexpensive way to avoid hugepage allocations from isolated pageblocks which makes alloc_contig_range() more efficient. Signed-off-by: Doug Berger --- mm/hugetlb.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index da80889e1436..2f354423f50f 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -1135,6 +1136,10 @@ static struct page *dequeue_huge_page_node_exact(struct hstate *h, int nid) if (PageHWPoison(page)) continue; + /* Check head pageblock isolation */ + if (is_migrate_isolate_page(page)) + continue; + list_move(&page->lru, &h->hugepage_activelist); set_page_refcounted(page); ClearHPageFreed(page);