From patchwork Fri May 19 11:16:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13248238 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 41179C77B7A for ; Fri, 19 May 2023 11:16:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CBA5E280001; Fri, 19 May 2023 07:16:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C6A8D900003; Fri, 19 May 2023 07:16:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B594F280001; Fri, 19 May 2023 07:16:56 -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 A7660900003 for ; Fri, 19 May 2023 07:16:56 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 6951580925 for ; Fri, 19 May 2023 11:16:56 +0000 (UTC) X-FDA: 80806752432.23.D3C520A Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) by imf20.hostedemail.com (Postfix) with ESMTP id 97F7B1C0013 for ; Fri, 19 May 2023 11:16:54 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=mKz7GTss; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf20.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.218.51 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=1684495014; 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:references:dkim-signature; bh=10duq/iSi0SrgAic2oFa0MSpSchsNelGTHibEkYiEYo=; b=L5VWAx2Z2E8hkK4qQI02bYcin7L9Kfa1bgSwvVyLIKX+GFkWB5OZ7AlHVXJRpYtyToO4Oq Yz9O+C9GihGhSl/3/a7XsUykWLYlN/pteOhQ0TBpJAZLEQsj8w3WXJJUZybDqM/S6hQgMT kbhux4clsVHhU6UMxrxHZg4xN+a/A9Y= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=mKz7GTss; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf20.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.218.51 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684495014; a=rsa-sha256; cv=none; b=OapHaFjtAZHghuS+QkYFWQMUTclD1Jcl8x/cq6ajlsIqJHO5bt0JW/BFaQkAGVabuI8xJ4 VpwoW3d8aZ5FA/3TVBQkYzwoDgRA2rm9yn2bnrTuNtUqTrUWMsew2yZwRmKn0D7Q2BMVBv qyJTJ7NKBTmo5pIp4Eoxooys/V42W90= Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-96649b412easo496389766b.0 for ; Fri, 19 May 2023 04:16:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20221208.gappssmtp.com; s=20221208; t=1684495013; x=1687087013; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=10duq/iSi0SrgAic2oFa0MSpSchsNelGTHibEkYiEYo=; b=mKz7GTssxphaehQ0POFeVEdVoWd4z55up137j0GfnPI88ZJwsrdzxQmls/Ks6d5OEk kJoRUnEWqNELsjiIbUjoKKNkLz6gDg7lTM6oDqlnramFhWpP3W4TSQCfUcdsYS65wcjl GIYJi68ZN5+VLfGQEDg5J0xrSy2Tmy+uHHzIZvRUcL5//5JkZ6MhjFasNQLvlIyZ8OEA FiAkPTtmbeD66T9etAa5C238TdyHP5ow8FYjITf/q4JLz4qSY/6n+zLyG9/1/9ZdAKI6 QHnBI2Yn3CcGECj1jCQ0SB2NDA9867HQmBtArryEYUyukzgYBNrQxcSfCtSbyRHGGEvB QRrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684495013; x=1687087013; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=10duq/iSi0SrgAic2oFa0MSpSchsNelGTHibEkYiEYo=; b=HL2a2QRN035+p4ysaIq8Qm2/PRfCad8JiRzO55Ih8uR53eYoFZcwR4nDmFENRJQ9ur VlejB6Oy1GeVrJD4+gIAvmAQdC3mLArHvYuFVVtYwC05LK2hz8fpkv06mPAt1cEY32MA zs0uwhTeRI0IwEe0v1rJdx/aCq1nCFt0iX9wIHypTyBoWtVFbUtp2Bha89iiXeGoVxHN iTOW9y3TujX9cOsq8jbAbV5qmYuSaPG/g8roWRkVntn1aqNGxdjJ2PxYNYgHYu9Q25fr ZSWSLFj+SfIqhHmFx20vwHzTOdC4QaJ8DTQ3tAH3iIVQlc+3OMkUZZwC275CyZtyZz7q 64lA== X-Gm-Message-State: AC+VfDwNclVJy9EkeZbBMpdALSo75GQFnz/bJ2sQJ012mu6znixh/+fR UT3IqhXc1iTzoI54nRLiwG0GgA== X-Google-Smtp-Source: ACHHUZ40QJHLQgWD3+zwLtMoGb2m9aCvrWRlNSFM9kTEHw69TlY/Ivppd2NBGoA5omT4uFnyrvGIqg== X-Received: by 2002:a17:907:9955:b0:947:ebd5:c798 with SMTP id kl21-20020a170907995500b00947ebd5c798mr1092652ejc.54.1684495013024; Fri, 19 May 2023 04:16:53 -0700 (PDT) Received: from localhost ([2a02:8070:6389:7d40:e266:3092:9afb:a7b1]) by smtp.gmail.com with ESMTPSA id t17-20020a17090605d100b0094edfbd475csm2127441ejt.127.2023.05.19.04.16.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 04:16:52 -0700 (PDT) From: Johannes Weiner To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH] mm: page_isolation: write proper kerneldoc Date: Fri, 19 May 2023 13:16:52 +0200 Message-Id: <20230519111652.40658-1-hannes@cmpxchg.org> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Rspamd-Queue-Id: 97F7B1C0013 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: teqbc19fg9wo5x535o14afgmahpcufcd X-HE-Tag: 1684495014-945593 X-HE-Meta: U2FsdGVkX18XAA4xtXhWrlRRHCawZR2Nmpl4dqil4OFJdKZ+79KGOLBzDr3mGYpJwsG3Gxr2QkWjwnoJ9d3Urx1TmjmAqJlZymMTNLV1klyRo1v3daGbB597x3IGfj3IOof3ZPn67oqXGyk6Ud8cfEACSb7mB2MJ8cdgIKCA5v0waGAU7FErXb5bzRVMWq8YWZaTx9eUUPOOrbADKpogpeJI6lMK8ulCwvmgQKh8BedC1fydbI2PiZsqdeYZUZa/5igkTfAB9/T0fQmc720pnWd5Xz/NJY1U2wVkm9uyhc7RFLtFSpcuKQLf3lPvF+pvZBKOLB6pjWaE1GPYAnWgiI5axDPkgnwYqIat1ntEKdhxz5ImqHYVLbEuNUJB5NsWoAKsiQzd9nMn8vPq1PTrrBgeJfAlQNVTX/6yP1HhSb5CbkFyxXfriTq5X62RZ3OeJpS+4HM6HGlX8KtpPDBx/FGAounV4/zsPF8NRk9YGksvMeZx1mb20rwGjRKZflS/6f7Q7Sbp/J7vEszhHz4kysglm9IuPHgHyuY8/YGKKiBRZT95SxjNidO8Wke/KLkAl1bkWz8czuURbKf7C44P+sIM545tWaENUzbiqf23UsJrqJn/VoeRYGZHJiLMxqIz0Gi8Q24cniYO7dElWBR1ZdLiKu41bIKFGlOumrsYbSYBPrqoB5kI2ZO0ulO+g9KGsjuaKLCGZ5s80Z61lr1cZfLav2+2y+1LRwW23Nl/BEqbNUmtUuXCONPpdaPAR92g9EVhLetHEYd8+pzL+bZWKM1EdClDVPLAmb3oIlIJSs6KXxWS0uoe+Gi5iISv41e5y+uMwnDVTraaxAsVH3/fxHjXfU2HiRvBTjv1QLMCFJ9rkgmtB22JxHa9Um3zboLJ1pfNUIhV2XKPNbetsJlG0j3Mh5EAMpTrws88dEwlTG67cwEbIQWuxIQDjew8XrCRE8CZOR/25uee/gfQY9g UXbZtLp7 dPcPqfIGUXQM0w270b2YQwi5birY2hM8BtPracraJPaNc5MVtKAF2Zy/BB22kdbvIZ3BJQlI8Rsh71TL3StwcnfIYx2G7JaJexi+FeVcw0ZYHmH/PjmNMosjCwxUjAazyu0YyjPVH+RarKnGh5B9iRh+ZCoulJGBH7ZP6PnyjP+/mxb/M6AD4VrujscT0opH79SMbMvJNwV8c3IOqbcBaGBCyhvgckN0mp9ZViPc8ZrJa6sJXoYAZh9ghPdS/wuGSBQCzugkJ1PmCsB/6B7a3JO7EKX2fSTTujGvdhny/t+G8jvXs8HFpw08KZhJjl7bu9X7QTOlMTCihRFp9s7x4sDzaSesSsbMoRuq0npXrF443g716FjrPcJ/uO5NotctM5dV6EzgPp7fdG/1ksj1VY2pH2XVccCZe3DOOayOBWeKv9pcAQ2XncyO3pywbW+6f+j+eoYxAbDI9floBsGjGLDMs4UbKEovv0F6KvJt5nHSxAPtAyespOF1PbM+ovzLYE2ICldTJQ7OrYW0= 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 c6f3605e37ab..e7d7685104de 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) {