Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp5994304rwb; Wed, 21 Sep 2022 15:55:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tNywNXFu2RDDGN/y+x7dd3g0ezkbYnhgWdlaWD9x3ahweMX6kc0f55yPtXja35InJCyuA X-Received: by 2002:a63:84c6:0:b0:439:4687:b63f with SMTP id k189-20020a6384c6000000b004394687b63fmr436499pgd.532.1663800947302; Wed, 21 Sep 2022 15:55:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663800947; cv=none; d=google.com; s=arc-20160816; b=ZEvhoEAPrQrEI413fRV9Cbn4/6K4qzq5mxNY26VodKyYJ6umF4Yw7ntoYaSvGG2QHj a2p95ZN6WSFtbYp/LSlttFAwGeSsxjQoqkZvDJtuhLrO9YxTCuSUGPHntmSQ0hTsYEeE 0P7k4OERneuJxjU6noCydmQf0g9Nw12DCljE87jFrMH23VcmhrxoZWPXj06qVRzFPkxQ ozHEBQUEas331ZFDwiYWItijbwOg/fNV2es1/zRW/WMrztwwuTfZTWZ9+BpeYx0ISj7i ZDWffG41gZneP9wSqL42qgXOeLHNxFuTgfAtnPDpcTEJz//8LA4msC4j1Jh3ZRBUQS4Z W2oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LmEVzalCJFIRHw39sUF5chZzrB9L9Ol3S17vl8cf3+Y=; b=ZJ10OdODjNi43LBX9q56KmyMP1Cul3A2jCwGLPfqxsk7XtHjK8Jv1GtlUOkhnIrd6m 7ote8VbluveKzyTmdfl2nQz+Xz7WcDLe8CL+hDvynbF/4XEcgQr2KeidIMR7DQVhJxjA o9niLnVn7G5gPeOHZwqwmi8sAzWirS8y0OlVKVB8EoBjhZyJ0gK7vkC5vBl0SJiLdgBa 83ukH5O/rhnBgLlopn/ADnqg5Cn25yQU5SF+vCRtXXjjHefO0WpjG5FQSEhE2Pnaqgky sG6ceEsd5NyuNWK3IUZ31Ds6IOqlPPaO4uSG4/JUQ21LVW/LR7anXG0MwvWcI5h2vicf d1wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=aZdar3AJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e63-20020a636942000000b00438762a8c81si3977708pgc.780.2022.09.21.15.55.23; Wed, 21 Sep 2022 15:55:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=aZdar3AJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230416AbiIUWhg (ORCPT + 99 others); Wed, 21 Sep 2022 18:37:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231191AbiIUWhY (ORCPT ); Wed, 21 Sep 2022 18:37:24 -0400 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0508AA8953 for ; Wed, 21 Sep 2022 15:37:23 -0700 (PDT) Received: by mail-qt1-x82c.google.com with SMTP id j10so5172953qtv.4 for ; Wed, 21 Sep 2022 15:37:22 -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=LmEVzalCJFIRHw39sUF5chZzrB9L9Ol3S17vl8cf3+Y=; b=aZdar3AJ1DG3bz5HOxv9V7SzAwaMBzRGfUiS2XhA18Fcs8H4Ak5WpiBR1K2Se7ALpk bO5X4Q3hs7tZXOHJ7kqDEFfkGSd5t1TshU98QnDHGeXRCCBrctK0s1+vmE/l9n+wMFEy KmuZhTGthHpG1FGxaAPgsnbYGSp3KhhNzHIGR4IpQ2IgFZn8JdyeTULbj5YlXASe6zfd +Jw+BUD1TUAvRH2kEJfCf3ILMgbKZCaqj3qJFLPXK0pLCCS4K5bnURD0A52RmHGkxMhB HN3Xhv0e+DFmztWDUwIiDLA5nfC0eLWMpyhpTMzmJLl6IKZ0XkD8fK0b08YlrPT44Rke zrrw== 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=LmEVzalCJFIRHw39sUF5chZzrB9L9Ol3S17vl8cf3+Y=; b=5m7PW4MNsVzHrFzvBZ08H5wHjCGOdZ2igJRWT33iFF9OCYJgu6mE44nwDJYMcmqwK7 2C/aeq4VHq4jxvpaARDt/oTJS1hB9+9FuejHs6eWhmFF+Tc7xyAKOmACrSKumAbrONnP 4VK+CaSxe203l8BaKS+lGQcOrgRfzXBXgZRdfDmNhFPw04HdwBy4iKW+WGVxrzpijx3J 0eU+urSrxy4sOQADUo4kUfbuTeHdq2xSXuta7V4Mp8h35p4GyFDYjFz8Dc5PBf1NB7w1 7CRxRDgEE4MT8+Noljz7q/BmV2n9ILi+YDxHYVovLYM6jYFl63o2h/4f0FGpQNfzUvOx WoNA== X-Gm-Message-State: ACrzQf117rEwJ4ensMcz2WI74AOvKLR4RemiOQXSzNuC3esWAQ1GAcae j9vvukM/LH5jLRDbY+A/vcg= X-Received: by 2002:a05:622a:1015:b0:35a:de14:45b1 with SMTP id d21-20020a05622a101500b0035ade1445b1mr569768qte.348.1663799842103; Wed, 21 Sep 2022 15:37:22 -0700 (PDT) Received: from stbirv-lnx-3.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id j13-20020a05620a288d00b006cea2984c9bsm2731540qkp.100.2022.09.21.15.37.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Sep 2022 15:37:21 -0700 (PDT) From: Doug Berger To: Andrew Morton Cc: Mike Kravetz , Muchun Song , Florian Fainelli , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Doug Berger Subject: [PATCH 3/3] mm/hugetlb: add hugepage isolation support Date: Wed, 21 Sep 2022 15:36:39 -0700 Message-Id: <20220921223639.1152392-4-opendmb@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220921223639.1152392-1-opendmb@gmail.com> References: <20220921223639.1152392-1-opendmb@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 eab812760fbe..3a2f0b55059d 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); -- 2.25.1