From patchwork Sat Jul 29 17:43:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13333059 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 915E1C001E0 for ; Sat, 29 Jul 2023 09:43:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A32418D0003; Sat, 29 Jul 2023 05:43:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E2A68D0001; Sat, 29 Jul 2023 05:43:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 773368D0003; Sat, 29 Jul 2023 05:43:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 590938D0001 for ; Sat, 29 Jul 2023 05:43:44 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 300DDC06CC for ; Sat, 29 Jul 2023 09:43:44 +0000 (UTC) X-FDA: 81064162368.15.AC22A94 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by imf23.hostedemail.com (Postfix) with ESMTP id 39344140008 for ; Sat, 29 Jul 2023 09:43:40 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; dmarc=none; spf=none (imf23.hostedemail.com: domain of shikemeng@huaweicloud.com has no SPF policy when checking 45.249.212.51) smtp.mailfrom=shikemeng@huaweicloud.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690623822; 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; bh=IZ/ybrQMSLoGamzR3ER5S8lsGGrYKsbtPQsucYnFdD8=; b=SPONGLeOqRbyS+EksdcwhmJNSXGRaet+sVtHI2TnUl7Gjovq9Zv8c4rOp/f5DUiI5tCYhq Mx6ZvwqdfD1dR9/UPhrpo1OJ2OwDn7mbgkxqyuBbljvkdzZTIQXELY99JJnPWdCe4hJDQp KJSTwm77nZZSAflj9TQSzZ5qPdbRgxs= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; dmarc=none; spf=none (imf23.hostedemail.com: domain of shikemeng@huaweicloud.com has no SPF policy when checking 45.249.212.51) smtp.mailfrom=shikemeng@huaweicloud.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690623822; a=rsa-sha256; cv=none; b=tV+NBvn2dqvm1oyh2MGyxdvjVqK9b73Oz2CAazhSy38dRdrIlnowO7CQ4dxP7f9B+l2f2x UaCCZUve5YMhfXd8jK8AQGfFwprGWsGYGpY+8fEjS7CrlSr1jsmeGqebC58XnAgmlCcoG1 OFdGKZ6nMS7Kvlvf3DRLwJZjtxUMayg= Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RCfhQ1yHTz4f403j for ; Sat, 29 Jul 2023 17:43:34 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP1 (Coremail) with SMTP id cCh0CgDHMy5D38RkAQcpOQ--.25635S3; Sat, 29 Jul 2023 17:43:34 +0800 (CST) From: Kemeng Shi To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org Cc: baolin.wang@linux.alibaba.com, mgorman@techsingularity.net, willy@infradead.org, david@redhat.com, shikemeng@huaweicloud.com Subject: [PATCH 1/5] mm/compaction: allow blockpfn outside of pageblock for high order buddy page Date: Sun, 30 Jul 2023 01:43:50 +0800 Message-Id: <20230729174354.2239980-2-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230729174354.2239980-1-shikemeng@huaweicloud.com> References: <20230729174354.2239980-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: cCh0CgDHMy5D38RkAQcpOQ--.25635S3 X-Coremail-Antispam: 1UD129KBjvJXoW7KrW8Ar1kWryDXFyfWryxAFb_yoW8KryDpa 47K3W29F1DuayYvFy7JrWkuF1jkwsYyF4jyrW5Kr18ZF9Yg3Z2k3sFyr1jvryjqr1fAFZ0 vr4DKFZ7CrsrZa7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBE14x267AKxVW5JVWrJwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2jI8I6cxK62vIxIIY0VWUZVW8XwA2048vs2IY02 0E87I2jVAFwI0_Jr4l82xGYIkIc2x26xkF7I0E14v26r1I6r4UM28lY4IEw2IIxxk0rwA2 F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjx v20xvEc7CjxVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2 z280aVCY1x0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0V AKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1l Ox8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErc IFxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v2 6r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2 Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_ Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMI IF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0pRxhLUUUUUU = X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 39344140008 X-Stat-Signature: 5g6mdr4u3fpxztyrxyd35raxq7hyoj91 X-HE-Tag: 1690623820-990136 X-HE-Meta: U2FsdGVkX1+1IqvG6OUPDAHdbt6kKeZGtDcYhX/rfe05SVjo/9va3eTngJ1xtZv4sTe5GqUgT28EBcwUybBFtOtFnl/x3R7PAIzoGOQpR4BEovziEU3j3+qT1l0dTogVdJDY1iPMoQBJPpgFXfOY26lXTy1CnKeSNXTds3rY2fcrtB09wqi95DBymLU7S/BlVrv9k3jq2wmc/4qZ8jQ0mikjPZawj42TK9YDR43yOBrrEDtcNLxNfq8SMHbJDJGncOkgtdcIUSMcrhZhCVvq2gxFc8PWiqrpF6BPGeCkLpa0Ska1/Ne595htazpkTY3WaIiFl+UcB6XPsg77MSnLj6Chc6BmpuXx/qnWMx92tR++F2RyH7vUUFMKkCUjvBoUMzm3jF2HMZkXZcbNrSpIl+d/tcUY0Em4cXqbUH0xfKpV1VTAQ9+52/KpDOhPvXlu0aqvVvWL1GDG9NN1biAfWQgnkLEW4+xOKjeYvEZZc3cUCVRyuyssLJATC6CkUHsLnN0UIQNLxLySg1L7AwUGVeypxjl0vIAEneVPIGBK+uuAtNGif+hV12wQ4zwsgo6hrXwDn+56WMts7xv8PvaAbYbuPqWKrO8J0qAqgf8F2K47TM244wdJl3q1R2SGYwgVvb30GWhqxuGE6mNz9Asr709mJLVL1636Z5i8LmEPyMfjPpIM9nrSxxM9pRhWt/RM1rQBCbmrmJVAuO9Oj+p7JHMM7kMaF2Ypuqris5oiJTcCNVjzfUXWKLzgoOpSBu9cqcUCKgZMiQmM2k+ccpWsKbY4ioFedGxntHtR2sW6O3BkflY0t42ExGGy+O/H6BDDJ7k1lCgyl8WkLfdZkF8Ob1Ys2nroKfLTK5ajLsXx4u2muhFuWpL0bMqQbuylXHXXVSyRMIB0+PBgCXrkchGdlyl8m/7ZKoMG5zyF/Ls7/WeC015jx20sfEzBccrxSvg/289LCzPv1EwCQGK5npD BwDrPRcf LiniGyH+RqaR68BIF2TiDQ/9yEWiY8g2s9Ld63WoDbssXDIzKWA6v2+iGKdGWFKwFueiUfqozwv212HaQaHlhVYM0LLm064kUKhaWMd9KC4+Buf7rWa/ck+Bi/p6KM45YLbMlF4R2JndR9dWgb8gItFFTupnD69TEG6o7T61A18o4o1F/xsl23pziiLv2QWoI1q15nDfMZgfjx10zDrI59arb+RxCJbnF6PtLy4UFxkRrl9bcEhG6ERGv+WQwXed4wm3bANvKT8I9DsU= 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: Commit 9fcd6d2e052ee ("mm, compaction: skip compound pages by order in free scanner") skiped compound pages to save iterations and limit blockpfn to reach outside of page block in case of bogus compound_order. While this also limit pfnblock outside page block in case a buddy page with order higher than page block is found. After this, isolate_freepages_range will fail unexpectedly as it will fail to isolate the page block which was isolated successfully by high order buddy page in previous page block and abort the free page isolation. Fix this by allow blockpfn outside of pageblock in case of high order buddy page. Fixes: 9fcd6d2e052ee ("mm, compaction: skip compound pages by order in free scanner") Signed-off-by: Kemeng Shi --- mm/compaction.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index 6841c0496223..d1d28d57e5bd 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -681,8 +681,10 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, /* * There is a tiny chance that we have read bogus compound_order(), * so be careful to not go outside of the pageblock. + * Allow blockpfn outside pageblock in normal case that we isolate + * buddy page with order more than pageblock order. */ - if (unlikely(blockpfn > end_pfn)) + if (unlikely(blockpfn > end_pfn) && total_isolated <= pageblock_nr_pages) blockpfn = end_pfn; trace_mm_compaction_isolate_freepages(*start_pfn, blockpfn, @@ -1418,7 +1420,7 @@ fast_isolate_around(struct compact_control *cc, unsigned long pfn) isolate_freepages_block(cc, &start_pfn, end_pfn, &cc->freepages, 1, false); /* Skip this pageblock in the future as it's full or nearly full */ - if (start_pfn == end_pfn && !cc->no_set_skip_hint) + if (start_pfn >= end_pfn && !cc->no_set_skip_hint) set_pageblock_skip(page); } @@ -1687,7 +1689,7 @@ static void isolate_freepages(struct compact_control *cc) block_end_pfn, freelist, stride, false); /* Update the skip hint if the full pageblock was scanned */ - if (isolate_start_pfn == block_end_pfn) + if (isolate_start_pfn >= block_end_pfn) update_pageblock_skip(cc, page, block_start_pfn); /* Are enough freepages isolated? */ From patchwork Sat Jul 29 17:43:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13333058 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 B126AC04A6A for ; Sat, 29 Jul 2023 09:43:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 65EF48D0002; Sat, 29 Jul 2023 05:43:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C3608D0006; Sat, 29 Jul 2023 05:43:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C8518D0002; Sat, 29 Jul 2023 05:43:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 2490A8D0001 for ; Sat, 29 Jul 2023 05:43:44 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E5EEC1201DA for ; Sat, 29 Jul 2023 09:43:43 +0000 (UTC) X-FDA: 81064162326.18.AFAE025 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by imf05.hostedemail.com (Postfix) with ESMTP id ED603100011 for ; Sat, 29 Jul 2023 09:43:40 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=none; spf=none (imf05.hostedemail.com: domain of shikemeng@huaweicloud.com has no SPF policy when checking 45.249.212.51) smtp.mailfrom=shikemeng@huaweicloud.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690623822; 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; bh=9meaUYhEJFtb8FcCU7b6xQzuXYdX0srDSO6ev7eCARE=; b=a3N21xGkg4cwZ06Nb88zdZZ2Ye3yEKhGe9x2UiuCrkZMCJPVyQ5Tw09mTX6Bce64Ct7AQy /TCVWBWMnXb5OwDfE9zWs5xSHIQC94jH9Kb4Rd0gzcrksHZvQjVnbbmmzZBOrE7CrunYqe Gu9Fh9khnHfeCUrrBpNfGoTUMIurPZ0= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; dmarc=none; spf=none (imf05.hostedemail.com: domain of shikemeng@huaweicloud.com has no SPF policy when checking 45.249.212.51) smtp.mailfrom=shikemeng@huaweicloud.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690623822; a=rsa-sha256; cv=none; b=kgk1eaQatwQuyd86n0RL5mBrJdSd6OYBN8vdLjCaVsQYM/q3FbKMj8/d/NwU/Zb+jkbWxq a8gY7fwDRJPF7hPx7L/+0YpTKTMw89bZvhESSl/G4xbYcGOcDPe2FoUcKjOmowOR4i9pWb 9h8dNEmxGjppNRSNGHu+xd8e2Kt3KdA= Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RCfhQ6fV4z4f3pJF for ; Sat, 29 Jul 2023 17:43:34 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP1 (Coremail) with SMTP id cCh0CgDHMy5D38RkAQcpOQ--.25635S6; Sat, 29 Jul 2023 17:43:35 +0800 (CST) From: Kemeng Shi To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org Cc: baolin.wang@linux.alibaba.com, mgorman@techsingularity.net, willy@infradead.org, david@redhat.com, shikemeng@huaweicloud.com Subject: [PATCH 4/5] mm/compaction: remove unnecessary cursor page in isolate_freepages_block Date: Sun, 30 Jul 2023 01:43:53 +0800 Message-Id: <20230729174354.2239980-5-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230729174354.2239980-1-shikemeng@huaweicloud.com> References: <20230729174354.2239980-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: cCh0CgDHMy5D38RkAQcpOQ--.25635S6 X-Coremail-Antispam: 1UD129KBjvJXoW7WrWxAFW3WF17CFWkXF1UKFg_yoW8Ww47pF yjkw1IyF40g345uFy7t3ykCr17Grs8KanrCr4fJrWrZFyftFyxZry2yr1UCrW8XrZrurZa 93yDKF97Kan5JaUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPY14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2jI8I6cxK62vIxIIY0VWUZVW8XwA2048vs2IY02 0E87I2jVAFwI0_JF0E3s1l82xGYIkIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0 rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6x IIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xv wVC2z280aVCY1x0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFc xC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_ Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2 IErcIFxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E 14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIx kGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAF wI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r 4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0pRvJPtU UUUU= X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: ED603100011 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 9d4ay7kmqr5dtt7w4c13wxzhq6mreyjy X-HE-Tag: 1690623820-218411 X-HE-Meta: U2FsdGVkX18CdWP1Jn8UD5pA1N5S/aUnghqMnXSDgBp8K9z36PvmuufjuN84K/Wjc2QYBSErHq+taJKiHRE5GctSjFZuLEpvCXspbkDqFjDvdCRhLlzZnagpqPXB4IfDci355TCJ2eKexzo3aJq7cZBYpF2ZcJcQV4cz+v84HVzSqqQsp/TvJECRi5VOji90Myt45ZWpMggHRgZfbD6/u60X9XmfA3yAQBJjTwXEdVUOSUIeB17NlKNZVrLdrQJcnbILKbHDGY+RSxXyuLztrPuhr7KznbULS9r/ERLva0aQRrTwztsJZUdpDu2DhEtfr4EfY+e9/D4sM39dMmvNMC0bdUTu5dRdpBMyA44cG1+/jKkTL6+7Z2FGudVCMqoXHsJQ9ClAffzZInTGpJyQj4a8mxVDFQp90EWP7mUtnNf/wG70iD/3vzJQ7FbrY2Mhx7EVNqPNob9JgwrB89id02Kvc++QK9ODowI2gHJIgMfJ24JIOGmRpIqmlH18pVrZDK+Hj2aFTks0dfGzpK5HEj2Xlyx9XgVUGUYs6G40Tm2h7WkDdmxop7Zvq8GFyeBkxDtLy/cUEF9Yxqt0ypl3TWsxlcMHTB24PEOBudiAcVa8b+qO0X26ohbv0HHb37N9vpKOmnvV4prBO5q0H7gWUC+mIxC4I3E4lpP738DsmKY9GPSOtDn9i08USGHuwVVtC1etieRo4whACQudscox84wI2VrnoRnsDVxjKI51c3iJjJNQ8I7/j5yH2X9fBhcJXkLhCh6AqLBZRs5BhyBUwez8hNToB36paBOxTsn7ak+EQFDndt02wYCVN9aeP3J8OZ0QRdOlAFFotUUYjsy9JGjDGq4Ajk2seJn6U7E+x7oBk0TS4tegJFM007vjLNoSyTVLXg5UbkZix0ypLADEow6nCSKGvWk80zwN+PVKgKN9ZoMdiuE0MoPS25Ki8G8FNgx/7V619cOvaox0Tgu teVGTnQt 29VRprLQ1Nj1psjX0OFKjgspeYqsRremb/TXyryKJNirURCkfk13fN9jS75oI8crzqmeOt4/NWZGUGKLqRz2ihS71aC2X0rXi/Os5GSD2hOYhMcTrcKqp1bbjX1kG6GxyCdGlR5v9DYa9yEJbdhhWvEch3eZFbIZqCK0DScvZr66vqwhysUb3qyt0SGuwmyU6fgJZr5ekBGGJQ/9PwiWYnh/PoLbtP99X80c+3rcknS397eeaKSvEHc0nbu8HNloFykZ8iDmXKup3r5VI6jqrYgmIZXaYBzc2kng9B4glcm7BCq06rD91IZN/DcM0LmKrD0HD 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: The cursor is only used for page forward currently. We can simply move page forward directly to remove unnecessary cursor. Signed-off-by: Kemeng Shi Reviewed-by: Baolin Wang --- mm/compaction.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index 65791a74c5e8..cfb661f4ce23 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -589,7 +589,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, bool strict) { int nr_scanned = 0, total_isolated = 0; - struct page *cursor; + struct page *page; unsigned long flags = 0; spinlock_t *locked = NULL; unsigned long blockpfn = *start_pfn; @@ -599,12 +599,11 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, if (strict) stride = 1; - cursor = pfn_to_page(blockpfn); + page = pfn_to_page(blockpfn); /* Isolate free pages. */ - for (; blockpfn < end_pfn; blockpfn += stride, cursor += stride) { + for (; blockpfn < end_pfn; blockpfn += stride, page += stride) { int isolated; - struct page *page = cursor; /* * Periodically drop the lock (if held) regardless of its @@ -628,7 +627,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, if (likely(order <= MAX_ORDER)) { blockpfn += (1UL << order) - 1; - cursor += (1UL << order) - 1; + page += (1UL << order) - 1; nr_scanned += (1UL << order) - 1; } goto isolate_fail; @@ -665,7 +664,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, } /* Advance to the end of split page */ blockpfn += isolated - 1; - cursor += isolated - 1; + page += isolated - 1; continue; isolate_fail: