Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp7047874rwn; Tue, 13 Sep 2022 13:00:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7tXPsQOWPEmHnERn2FGgzK6Ih9ymG4wZjeiFId4wqNA8PdrdFgQMT6CSIFebI8vqT5lZgD X-Received: by 2002:a17:90a:d585:b0:1f4:f9a5:22a9 with SMTP id v5-20020a17090ad58500b001f4f9a522a9mr925371pju.49.1663099251023; Tue, 13 Sep 2022 13:00:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663099251; cv=none; d=google.com; s=arc-20160816; b=o+AydTkHCZhclcPOD2lMOaHtjnRBvbDu6KfNFTOggvNPgmXFdt49LJ7bHS5Seh75Dt lUvqouJHfgCDsTtXildq5l2pHw45vBOA6tFZBOhHZVSAH9JVcPkMePzwZ2jGvC0MGWDo 8GBaYaXkG4ANnW6i4UNHHj5m/lDlaNu0EWVBUGnspqoFwz4XjesOXX+eq8JmOubHoKIk QBAJuIRwPqRcuOLyW1lcPy3bOMpMjVjwJ5H2knd/LKo4jjPODirZlna+bk2lYtjXuH7w UzZH5X2lbJ0wUCiyC3rwUNfFk4By2cBySRq9flFqk0KM61xzI3a1yDGdzv7Pgz2IgH4j 3tpQ== 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=5478I3WyUfDJcI1zhJnzCnFwBV1ia1XR+sLHu3XJI6Q=; b=Las9Kx/1NtDoA/xakFxL71pZ7hRe1/+c9SHhkkT92dwha1uYH9gITcXWtKMMnfW5Q0 yoqwZZKrSK3KSCpgU7EJH7gMsHZAuo6KqKN8kwBRsAhcK3xLnmNeSmuz799Ri9yjCe7f cAPADlWxOlxDS//hLPFF5w1Ddph4j05uF3CoPGw5h1kqvHCvLbXcRSN03/v6ZVKKvlzz xq1phmN6dYvdBvKIiWICEcCQMKaaRi+itnkfcvX0ow9DH/tJ2/JVbogZSv1VEArZAsCT hk/WuS4dUuFby0/WMngB4xaPs7KTH9EHduXnJOU+1Z40HrlNDF0Op+7dsdln2RNQt1uF oHzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ngWpsEYV; 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 l11-20020a170902d34b00b00178431e09bdsi3645088plk.230.2022.09.13.13.00.34; Tue, 13 Sep 2022 13:00:50 -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=ngWpsEYV; 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 S230043AbiIMT6x (ORCPT + 99 others); Tue, 13 Sep 2022 15:58:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbiIMT62 (ORCPT ); Tue, 13 Sep 2022 15:58:28 -0400 Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D24F78200; Tue, 13 Sep 2022 12:58:18 -0700 (PDT) Received: by mail-qk1-x72b.google.com with SMTP id d15so9307283qka.9; 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=ZdpfxQH5JMWc9atFLaVl342kjTClvqmVLm6tWN8jUEJSadOqlZRCjWzEKZ2gqlrXun svhU85L1/UsjszGpxALGj7CavklIt/24+En7eaWEUs5VinJYbxMFgGZWmXOq6Jd91K+i 39r4he9C3wSa5mPX6jZ8AgJ3o0JM/frfMgOrLVGR4kGF/dcqJQbJ2Umv27AH9vmJKWw2 oZqHXTGes5RTFpEMNcNS7ldLFJtXfcLAqtvf3xpQ6kJwgzoqBkV3ty3ETMi9fCnks8px aRtf5KgXyQkUx7Kn0VoolTHaRA7sxep65RQK6UyXYap8F5uYDdqMPx75F7cMo7/ei1qj MALA== X-Gm-Message-State: ACgBeo3gHm0/c7qvp8ADIW3PPtIMJxy+4sB8U8lcgx5ldy86SKdunGTy MYSxew3nscFHdY2tZ+F0N58= 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 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,T_SCC_BODY_TEXT_LINE 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 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); -- 2.25.1