From patchwork Tue Apr 18 19:12:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13216092 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 7B89BC77B7D for ; Tue, 18 Apr 2023 19:13:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2F4668E0005; Tue, 18 Apr 2023 15:13:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A560900003; Tue, 18 Apr 2023 15:13:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 11D4E8E0006; Tue, 18 Apr 2023 15:13:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id F0B7C8E0005 for ; Tue, 18 Apr 2023 15:13:26 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B36B3AC2A5 for ; Tue, 18 Apr 2023 19:13:26 +0000 (UTC) X-FDA: 80695460412.06.7D61D62 Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) by imf20.hostedemail.com (Postfix) with ESMTP id F038B1C0012 for ; Tue, 18 Apr 2023 19:13:24 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=kkfQYtWH; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf20.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.174 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681845205; 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=TaODw93P+SR5wwuqKRfmGnBXSp8Lv6zFL4m1Q/yirc8=; b=aLyzoBurPCrxS6elij+x2beDSk9EHh6TDVJxQlSuksKqHFz0dn+iNTaNHLP5n07HII31RO RLaQK7Rb0HN7VRZ69L3AH7w9Gev5V36/Xhs6d2itC4o4jADokqgyElOaA0P/kf9djZEW// lM/IrwxWxafXR8gXxDi9aPT78zFIKFs= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=kkfQYtWH; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf20.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.174 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681845205; a=rsa-sha256; cv=none; b=NChviwZBQS5xEPVpsuHv8bzwAb+HQhtE9LPtBXPexC81Vt9jHgFoHFK6yNXRoocp+5rkGV CmYff4tdOh+ir4bBdcp5UR8oqPAXFBaDBIIBaprzUSXCOIbqZrYAjKAIvqsI6mP5vrWX2G KP2xSDoSNGdEwDGwTbCBIs6Kv68kZ3Y= Received: by mail-qt1-f174.google.com with SMTP id fg9so9511064qtb.1 for ; Tue, 18 Apr 2023 12:13:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20221208.gappssmtp.com; s=20221208; t=1681845204; x=1684437204; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TaODw93P+SR5wwuqKRfmGnBXSp8Lv6zFL4m1Q/yirc8=; b=kkfQYtWHK0cjsqR3Tr2Evmha89C/CGQuIEEPuLJT4pN5xWQi7d8Vq8uFMbzxn0pTuC vDsdfEFFx8thdvtcSffx5yY2knbkiKEIrb36FC9V3aQefF2s2mRjSVPD8070oJiQg8ZU r5RGXeP3tLr0RU10A3wP/Cz9FMVpBN6V/JJLvDmUodacBd0JSArMMCR8nLaXExEBOlpe yNw3G0y7GS5KEOFNn1FFACN24lKo6bTWTBgwy+WWKudhSd5CtHRcuY63yhaEwdjZrzkl 7WYaotdrp8RPDc3Q3kZ6QS6x9WTWeqdC+Y/EyJLjEHZmM+bvNm4BrANxjwU1IMwgDCiF l0rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681845204; x=1684437204; 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:message-id:reply-to; bh=TaODw93P+SR5wwuqKRfmGnBXSp8Lv6zFL4m1Q/yirc8=; b=GS70F7xiW0Z9Ex2zIwArYzKSZVw7G220Htlq0WirVVmjUdHND/LeQeeL4uU87ovHO/ OtYLDQIcbOW6qbxIi/LAlEbS901J/PtS8OvSpl6qX2g6sY3b3QnLCOwjkTK6pFRqjHdF zymgvlJPlKLLGSu/wYNuOrThHxHpIn1W/nhLzueqnEh56Wl4CtGGmkcQHclIKzOa7TQs iEmY6ex2rLeoowyRQ+S1XNwqnM5VdWmFxm6pmUAcvE3SaCXfWRoFlipUHK/xno04rUUT fLVk2831sZvn8gH2m57No0NOVF0j/HMLitC8grY+E0Nbg6uhjgZUxQl8KPN/Y/hD2Ahv 64iQ== X-Gm-Message-State: AAQBX9d4j3kLXfxB2FZjzxp+OA2naxUHBd+k5h7zMgrrfKi8wWiV+rjR pKgsrlLChFxRaljoBLDuUKZvHQfG6QuQVUbhgAc= X-Google-Smtp-Source: AKy350aw5jRncIivAr25Em9/snSJvkqiUm+fvvm6Oxsi6j5yZZnDL1qzCh3Cxx7kfD1wTwtewWkLkA== X-Received: by 2002:a05:622a:1042:b0:3ef:2db1:6e75 with SMTP id f2-20020a05622a104200b003ef2db16e75mr1455616qte.24.1681845203869; Tue, 18 Apr 2023 12:13:23 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:e646]) by smtp.gmail.com with ESMTPSA id p23-20020a05620a22f700b0074ad04609f8sm1217413qki.117.2023.04.18.12.13.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 12:13:23 -0700 (PDT) From: Johannes Weiner To: linux-mm@kvack.org Cc: Kaiyang Zhao , Mel Gorman , Vlastimil Babka , David Rientjes , linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [RFC PATCH 04/26] mm: page_isolation: write proper kerneldoc Date: Tue, 18 Apr 2023 15:12:51 -0400 Message-Id: <20230418191313.268131-5-hannes@cmpxchg.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230418191313.268131-1-hannes@cmpxchg.org> References: <20230418191313.268131-1-hannes@cmpxchg.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: F038B1C0012 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: 16samhfhpnkxh4zadc6hwz4g3a7z1qwb X-HE-Tag: 1681845204-273817 X-HE-Meta: U2FsdGVkX19Oef4/PPFZD7aNg3BRMdn2vfYkhvUuinPydN9HPKPiCviSRPNRHSpyGdrBjA0rDRGuJYto1XP6MQgm7VmHp9ljzOqpPxFwfrD1vGVcEDVvDGOpesKknNj8mnQdBE4UG3Bx2PUFeh16UrMyVewDNFq4KSCrqnbeVyn6IYRKwBluTUUQ1Q8AgRVRa2raOF382kT4aC+hiLxEB3zPI6TZ1ALHLuvTAc3wa07DkR8EbOcvQdavTzkiCQABaYEVXa3AVQ229v7/C/XRVvQze0KiCUgBDSovueUJFU3LxX5ZfCEkUlp29qRHRUmNcLf3r3HYxqyNAe+Y8exylY+NcbqhjvsG88p8q/7oxFYp+4c0CdBKSWWhAb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LcjALccMLr+cNgcLf5QeZnQ+okcMbLlK/bnNjJn3cFuOvYLFtWDvhgnEW+Uvj8gPYNAGfw== 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: And remove the incorrect header comments. Signed-off-by: Johannes Weiner --- include/linux/page-isolation.h | 24 ++++++------------------ mm/page_isolation.c | 29 ++++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h index 5456b7be38ae..0ab089e89db4 100644 --- a/include/linux/page-isolation.h +++ b/include/linux/page-isolation.h @@ -37,24 +37,12 @@ void set_pageblock_migratetype(struct page *page, int migratetype); int move_freepages_block(struct zone *zone, struct page *page, int migratetype, int *num_movable); -/* - * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE. - */ -int -start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, - int migratetype, int flags, gfp_t gfp_flags); - -/* - * Changes MIGRATE_ISOLATE to MIGRATE_MOVABLE. - * target range is [start_pfn, end_pfn) - */ -void -undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, - int migratetype); - -/* - * Test all pages in [start_pfn, end_pfn) are isolated or not. - */ +int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, + int migratetype, int flags, gfp_t gfp_flags); + +void undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, + int migratetype); + int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn, int isol_flags); diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 47fbc1696466..b67800f7f6b1 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -481,8 +481,7 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags, } /** - * start_isolate_page_range() - make page-allocation-type of range of pages to - * be MIGRATE_ISOLATE. + * start_isolate_page_range() - mark page range MIGRATE_ISOLATE * @start_pfn: The lower PFN of the range to be isolated. * @end_pfn: The upper PFN of the range to be isolated. * @migratetype: Migrate type to set in error recovery. @@ -571,8 +570,14 @@ int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, return 0; } -/* - * Make isolated pages available again. +/** + * undo_isolate_page_range - undo effects of start_isolate_page_range() + * @start_pfn: The lower PFN of the isolated range + * @end_pfn: The upper PFN of the isolated range + * @migratetype: New migrate type to set on the range + * + * This finds every MIGRATE_ISOLATE page block in the given range + * and switches it to @migratetype. */ void undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, int migratetype) @@ -631,7 +636,21 @@ __test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn, return pfn; } -/* Caller should ensure that requested range is in a single zone */ +/** + * test_pages_isolated - check if pageblocks in range are isolated + * @start_pfn: The first PFN of the isolated range + * @end_pfn: The first PFN *after* the isolated range + * @isol_flags: Testing mode flags + * + * This tests if all in the specified range are free. + * + * If %MEMORY_OFFLINE is specified in @flags, it will consider + * poisoned and offlined pages free as well. + * + * Caller must ensure the requested range doesn't span zones. + * + * Returns 0 if true, -EBUSY if one or more pages are in use. + */ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn, int isol_flags) {