From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B857C433DF for ; Fri, 14 Aug 2020 17:31:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C830A20768 for ; Fri, 14 Aug 2020 17:31:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tqi5HlG8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C830A20768 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 222C48D0006; Fri, 14 Aug 2020 13:31:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 09B078D0003; Fri, 14 Aug 2020 13:31:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE1528D0006; Fri, 14 Aug 2020 13:31:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0023.hostedemail.com [216.40.44.23]) by kanga.kvack.org (Postfix) with ESMTP id C14F38D0003 for ; Fri, 14 Aug 2020 13:31:46 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 8EF6E4DD0 for ; Fri, 14 Aug 2020 17:31:46 +0000 (UTC) X-FDA: 77149866612.02.camp61_3d1310326ffe Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 66C6F100C0CC3 for ; Fri, 14 Aug 2020 17:31:46 +0000 (UTC) X-HE-Tag: camp61_3d1310326ffe X-Filterd-Recvd-Size: 6294 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Fri, 14 Aug 2020 17:31:45 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id g15so577252plj.6 for ; Fri, 14 Aug 2020 10:31:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=P7rqSrKy/nnoTM8CqDIfpiZXkUt7aO0uWJ6Gz+yM4ps=; b=tqi5HlG8hhVI+w8Ue9/7W4j7xwOkOsdYKdr8TCC8WT8bhI7UWQv6R8wvVzfgXTDCFm zlnuE7QmGQ4U/IT4hkIjkK7KRMLyCyvcL1vtCE2RO/z6mkzHjxCbdlUst5wompRgUaF5 DF2qdF9ksDaG4bvI20ZBSsw8Mp1qocV0TVIi31Is8gZcjkLtP26y0lDcaPCKendWaoxm waO1nVBPQv7klVgJrOffQ1BE89CZqQeCITwZDg0OU0JaTpxObQe06VHEw5m8nYkBZe+y Y2xLf9cBmGx64aaa3MHfEeZLe+nUsd82+Oy7Lro+WHIL1l1r8h68vFT3s54pi4kBwz/g Phpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=P7rqSrKy/nnoTM8CqDIfpiZXkUt7aO0uWJ6Gz+yM4ps=; b=PxR8QRKDQBijSB0P6eaHhNU5+GIYXmFbwiBO1ZAc6MwTW5Xa1+ES6PbhwW2U1+SMV9 Fqrl5rcW2zXcxHy+1SCHDSIbPBwydcWQMY/oxtLGHbMmyx9Yz/Fp6mNZa68rknA6IDX7 SI45nJIfnG/q97VWrEja36VXBlJ6Q+49hEqdSfvOw4A6+pufbT7gb5u3QnvjjRrxmuIh JzcgHUalgAsHIW5biW2m22O/SkGQjIdeP5Fvyz3yDHhUFSMbzsdTq3vNOGV9Na3OtdKp rq+KMdAsm7v6fSt6SrHbZICede6rGtR3J3wgiLRM+ELf4eTn+VroDHNvIfZoLFdbe1yZ 6/pg== X-Gm-Message-State: AOAM533ebSLevivMjOZ5LEDYDS/qUhhbuRr8S2IrDig97KtVuPkjXBCH nYTn/RZRNKkxjYbP/ESBOmTac3Km2qQ= X-Google-Smtp-Source: ABdhPJxOc52ILuwtRtW5VknmfR32RY7TWmdQ/9lQA/hy1dC06Z8JjXec2VabI2CX9fKzLSSTcAcllw== X-Received: by 2002:a17:90a:c201:: with SMTP id e1mr3069280pjt.142.1597426304724; Fri, 14 Aug 2020 10:31:44 -0700 (PDT) Received: from bbox-1.mtv.corp.google.com ([2620:15c:211:1:7220:84ff:fe09:5e58]) by smtp.gmail.com with ESMTPSA id n22sm8522973pjq.25.2020.08.14.10.31.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2020 10:31:43 -0700 (PDT) From: Minchan Kim To: Andrew Morton Cc: linux-mm , Joonsoo Kim , Vlastimil Babka , John Dias , Suren Baghdasaryan , pullip.cho@samsung.com, Minchan Kim Subject: [RFC 4/7] mm: factor __alloc_contig_range out Date: Fri, 14 Aug 2020 10:31:28 -0700 Message-Id: <20200814173131.2803002-5-minchan@kernel.org> X-Mailer: git-send-email 2.28.0.220.ged08abb693-goog In-Reply-To: <20200814173131.2803002-1-minchan@kernel.org> References: <20200814173131.2803002-1-minchan@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 66C6F100C0CC3 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 Content-Transfer-Encoding: quoted-printable 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: To prepare new API which will reuse most of alloc_contig_range, this patch factor out the common part as __alloc_contig_range. Signed-off-by: Minchan Kim --- mm/page_alloc.c | 50 +++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 4caab47377a7..caf393d8b413 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -8401,28 +8401,7 @@ static int __alloc_contig_migrate_range(struct com= pact_control *cc, return 0; } =20 -/** - * alloc_contig_range() -- tries to allocate given range of pages - * @start: start PFN to allocate - * @end: one-past-the-last PFN to allocate - * @migratetype: migratetype of the underlaying pageblocks (either - * #MIGRATE_MOVABLE or #MIGRATE_CMA). All pageblocks - * in range must have the same migratetype and it must - * be either of the two. - * @gfp_mask: GFP mask to use during compaction - * - * The PFN range does not have to be pageblock or MAX_ORDER_NR_PAGES - * aligned. The PFN range must belong to a single zone. - * - * The first thing this routine does is attempt to MIGRATE_ISOLATE all - * pageblocks in the range. Once isolated, the pageblocks should not - * be modified by others. - * - * Return: zero on success or negative error code. On success all - * pages which PFN is in [start, end) are allocated for the caller and - * need to be freed with free_contig_range(). - */ -int alloc_contig_range(unsigned long start, unsigned long end, +static int __alloc_contig_range(unsigned long start, unsigned long end, unsigned migratetype, gfp_t gfp_mask) { unsigned long outer_start, outer_end; @@ -8555,6 +8534,33 @@ int alloc_contig_range(unsigned long start, unsign= ed long end, } EXPORT_SYMBOL(alloc_contig_range); =20 +/** + * alloc_contig_range() -- tries to allocate given range of pages + * @start: start PFN to allocate + * @end: one-past-the-last PFN to allocate + * @migratetype: migratetype of the underlaying pageblocks (either + * #MIGRATE_MOVABLE or #MIGRATE_CMA). All pageblocks + * in range must have the same migratetype and it must + * be either of the two. + * @gfp_mask: GFP mask to use during compaction + * + * The PFN range does not have to be pageblock or MAX_ORDER_NR_PAGES + * aligned. The PFN range must belong to a single zone. + * + * The first thing this routine does is attempt to MIGRATE_ISOLATE all + * pageblocks in the range. Once isolated, the pageblocks should not + * be modified by others. + * + * Return: zero on success or negative error code. On success all + * pages which PFN is in [start, end) are allocated for the caller and + * need to be freed with free_contig_range(). + */ +int alloc_contig_range(unsigned long start, unsigned long end, + unsigned migratetype, gfp_t gfp_mask) +{ + return __alloc_contig_range(start, end, migratetype, gfp_mask); +} + static int __alloc_contig_pages(unsigned long start_pfn, unsigned long nr_pages, gfp_t gfp_mask) { --=20 2.28.0.220.ged08abb693-goog