From patchwork Sat Aug 5 11:07:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13342477 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 706A0C00528 for ; Sat, 5 Aug 2023 03:07:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8D1648D0006; Fri, 4 Aug 2023 23:07:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 85BB98E0001; Fri, 4 Aug 2023 23:07:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6AF548D0008; Fri, 4 Aug 2023 23:07:09 -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 481C28D0006 for ; Fri, 4 Aug 2023 23:07:09 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1CBA01405A8 for ; Sat, 5 Aug 2023 03:07:09 +0000 (UTC) X-FDA: 81088564578.09.BCFC6E9 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by imf10.hostedemail.com (Postfix) with ESMTP id 4E8C3C0011 for ; Sat, 5 Aug 2023 03:07:05 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=none; dmarc=none; spf=none (imf10.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=1691204827; 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=aJHA8BSe5njikIfoG5Z4T29pS+C99yFvrv2vyqmBURM=; b=y7OznlZOfKPLr5Sxvehd3IaA+LzlztzyC7LTguM9yykH91uQPDsKmulqIcUBTZoucsuELQ SSYvK8ZtrMUwtIv9wcBn8BvAeWrbLZTw/LSNP2ysNolEW0O/L2hU/7ZFSROC6+tQEUv4Uu YC3PaY9T9584zXHpit5qmtoF0QE9E+8= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; dmarc=none; spf=none (imf10.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=1691204827; a=rsa-sha256; cv=none; b=SEKNlAnErJEUYJQLmMve5Ca7iOWTLXlwbak1WfY2JG/rbAs1nBi0T8VNRg0Rkb1DMW3CxG tz+9yf49djXNJG4XM8wd7vXNEpWX8I4mPo8VnY8yiddjqIMKw40Zl2i7woJdzpRSFvvdoe 2HSl7yoo9zmaYbf/DiO1Va0/dT60ZC4= Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RHnYZ3zshz4f3m87 for ; Sat, 5 Aug 2023 11:06:58 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP4 (Coremail) with SMTP id gCh0CgAHvrHQvM1k6A5ePg--.23962S4; Sat, 05 Aug 2023 11:06:59 +0800 (CST) From: Kemeng Shi To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, baolin.wang@linux.alibaba.com, mgorman@techsingularity.net, david@redhat.com Cc: shikemeng@huaweicloud.com Subject: [PATCH 2/9] mm/compaction: call list_is_{first}/{last} more intuitively in move_freelist_{head}/{tail} Date: Sat, 5 Aug 2023 19:07:04 +0800 Message-Id: <20230805110711.2975149-3-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230805110711.2975149-1-shikemeng@huaweicloud.com> References: <20230805110711.2975149-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: gCh0CgAHvrHQvM1k6A5ePg--.23962S4 X-Coremail-Antispam: 1UD129KBjvJXoW7ZFyfKF47KryDWF13ZF4fXwb_yoW8Wr1xpF W5ur4rJr48ArWrCFnrXF4q934rJF43Z3yYkrWY9FyUAFn8JrZ2gFySya1jvr95XrWUurWY vrsrKr4rurW7Ar7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPSb4IE77IF4wAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M2 8IrcIa0xkI8VA2jI8067AKxVWUXwA2048vs2IY020Ec7CjxVAFwI0_Gr0_Xr1l8cAvFVAK 0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4 x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l 84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I 8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AK xVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zV CS5cI20VAGYxC7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E 5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAV WUtwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY 1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI 0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7s RNVbyUUUUUU== X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Rspam-User: X-Stat-Signature: 4z46eid8mhibreskiis4x5sh8jkkje7s X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 4E8C3C0011 X-HE-Tag: 1691204825-298275 X-HE-Meta: U2FsdGVkX1/VqSdlbdVvT4UdMxwZU/VYXRFee2yj8aT7vFq8S/utqwQRmm7UE+Ccl4xyxFtpOGkmed/qDN2hcqvIAhOe7MdDg5mZUkLqNUr6bPTRBVBShgxZwOvC1ExT1B7fW8UG36H5Q8808m6vhs6+3grFiO3RBwncfcQ0eY7IX+dQBaEEzBMA361iFQIDtb9PO8vaotzoq6hABz7aUCaQ1J6vkVeDTdjpHZxz6S4O5lQM2r+pwNq6ScVrwAGn3wsAlW18DYrLo6dLQO7gnDAYeVNTPb5A+3Lei2Dc3jz/d7J3Dd9TnspzDdu3uBr4EPu3PAzbDOyJCmShGDK38dTphPiJTytNWsOMD1sLK4vPVmUz6weL3ld8e04IlJ+48EoKseqC9H2jBznIW1Pkem4vFox3RkNtsZb8UHdqftzRccuw+kT3XwkR6P0cLAwUleHtfkJi2TFTvkZZ/SnHDvU88BlLgdT7HVM1BFZL8KeKxISf2HEui6/8F70spIAT4sanBGLLeHca4A/JE96/HYn79G8yGCDXbHrSX5wAfUvJL9snL3QHXWYnWX44tEtBk6hEhTDaqQovDm020vYBlkhHSlnPlnGFZwgXC0rrJJfAeVXmPRRjA8ifAOBWWAGgdOSclMqei+4NgbwC4koJdd0VUiQey7WtVo25O3z6iuyGLs9ukV3D2MEurSGe7g/rhpMFm87DFZ7BQUFiWqGqrt/HafaFPAx3Y3KsgHOykOQuXvpcvzSxwKZDQk6CrKUIWm+ePOypF9Kg3SVOX8GiyQCGgPTsbyokqFd9sEo1VUbzmo1kN/ZLHY5BN2IOo6e2xa4vwJTR28geSBDW3iyc1dW3EhAIVk5sSSY74Z04WgO8aLucH1cMrY2JOnizQRsZiKwTy4AmNCKtqLzvcQzEwLbOhLBeHenMf5zV8W0vthhv1V3eEsZ/X/PYfu62jF9+d0qcRNLt1/eXQbShGVw Ike3cqGG Z0l9dTcWRQ3s09K5s9HZYwtE7BaUynxHt7/BABEgZfjAMqovOL2VzBk04h7DbB7BSys7e/TztStpECGpzNsdLquRCAQ7gPF39M9+yiGt+FHST/5+szcAXojjHOeUu7yWuCnJPxhLd9NCg9IHZcPSYJKC6XXg0B35feVuhdUdnp501YuC/WkPCBZCFLvcofnZIoj7Zyy3VOVIneGWdy2nnwyPgYg10XdIb4I7uMHVZYuiiaKhQo5kQpr0nfDCpPFxGIHlDvv13jQu+hyE= 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: We use move_freelist_head after list_for_each_entry_reverse to skip recent pages. And there is no need to do actual move if all freepages are searched in list_for_each_entry_reverse, e.g. freepage point to first page in freelist. It's more intuitively to call list_is_first with list entry as the first argument and list head as the second argument to check if list entry is the first list entry instead of call list_is_last with list entry and list head passed in reverse. Similarly, call list_is_last in move_freelist_tail is more intuitively. Signed-off-by: Kemeng Shi Reviewed-by: Baolin Wang --- mm/compaction.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index 513b1caeb4fa..fa1b100b0d10 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1395,7 +1395,7 @@ move_freelist_head(struct list_head *freelist, struct page *freepage) { LIST_HEAD(sublist); - if (!list_is_last(freelist, &freepage->buddy_list)) { + if (!list_is_first(&freepage->buddy_list, freelist)) { list_cut_before(&sublist, freelist, &freepage->buddy_list); list_splice_tail(&sublist, freelist); } @@ -1412,7 +1412,7 @@ move_freelist_tail(struct list_head *freelist, struct page *freepage) { LIST_HEAD(sublist); - if (!list_is_first(freelist, &freepage->buddy_list)) { + if (!list_is_last(&freepage->buddy_list, freelist)) { list_cut_position(&sublist, freelist, &freepage->buddy_list); list_splice_tail(&sublist, freelist); } From patchwork Sat Aug 5 11:07:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13342475 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 AABC3C00528 for ; Sat, 5 Aug 2023 03:07:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7BFF18D0003; Fri, 4 Aug 2023 23:07:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D7E18D0006; Fri, 4 Aug 2023 23:07:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2DB528D0007; Fri, 4 Aug 2023 23:07:08 -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 107CF8D0003 for ; Fri, 4 Aug 2023 23:07:08 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D6A031A02C0 for ; Sat, 5 Aug 2023 03:07:07 +0000 (UTC) X-FDA: 81088564494.18.F30C0ED Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) by imf05.hostedemail.com (Postfix) with ESMTP id A478D100006 for ; Sat, 5 Aug 2023 03:07:04 +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.56) smtp.mailfrom=shikemeng@huaweicloud.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691204825; 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=TnEuM+JFuyPJEF5vsFmy3+0fVDqCpjqTmz6mI4Gk1yk=; b=Z7tB2x10JnChYRfofpKYakYEq91mXV13kWkfxYCmfRnip0q4768mX1aUSiQgmGh23MXkx3 aM74N0bXmGF6oT4eKWwjBe8jdKXiX4CeJOqPE965NmoyFN5bPuyj/YQJ3wV9s9emKRGacG WlqMHjD9Hsln+KgAbb3LVu+ApG4sKYA= 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.56) smtp.mailfrom=shikemeng@huaweicloud.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691204825; a=rsa-sha256; cv=none; b=Y8x1FpNesY3oY8ipPteW4pi2dVyUPX6VOmHYQB4xnHZizJ/LFQpzJQ8cp9RuInURgjDWv5 10RWyDUjX5PJ6SdbeBQvn5LcjTWMUdISH70XIDTYlX5frzik+0izNSLU89bThFUMm3xwdi /1iWFsOtO0J7aC1gV18VRDtomVVKRG4= Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4RHnYY1v9Tz4f3lKr for ; Sat, 5 Aug 2023 11:06:57 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP4 (Coremail) with SMTP id gCh0CgAHvrHQvM1k6A5ePg--.23962S7; Sat, 05 Aug 2023 11:07:00 +0800 (CST) From: Kemeng Shi To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, baolin.wang@linux.alibaba.com, mgorman@techsingularity.net, david@redhat.com Cc: shikemeng@huaweicloud.com Subject: [PATCH 5/9] mm/compaction: remove repeat compact_blockskip_flush check in reset_isolation_suitable Date: Sat, 5 Aug 2023 19:07:07 +0800 Message-Id: <20230805110711.2975149-6-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230805110711.2975149-1-shikemeng@huaweicloud.com> References: <20230805110711.2975149-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: gCh0CgAHvrHQvM1k6A5ePg--.23962S7 X-Coremail-Antispam: 1UD129KBjvdXoWruFyxur4ruw48JFyxCr15urg_yoW3Wrb_Jr n3KrsYyrW5ArykZrZrArsIyFs0gFWkAr1UWr1qqa1Yy3sIvFsYqa1DZF17Zr15XFW7Wr93 u3WrZFyYkF1fWjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbDkFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M28IrcIa0xkI8V A2jI8067AKxVWUAVCq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJ M28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2I x0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK 6I8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4 xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8 JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20V AGYxC7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAF wI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc4 0Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AK xVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr 1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7sRiVbyDUU UUU== X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: A478D100006 X-Stat-Signature: o7dompn5wfbd1ans67yod3zjbxrndetb X-Rspam-User: X-HE-Tag: 1691204824-978712 X-HE-Meta: U2FsdGVkX1+xYbu81PBqusueCGWAHwskuB4ySrFYAGs054eLZIk0w5h89xIrbp/colehrLq/01gWwf8gRpfXc9eq3mAL/9VjcXo0r3EjCtbUFga7c/WQwLuY4lQCgCDQB7WhEwczmCEnpaC8YmeaXNglElB34sXbpyJOWtTyzIpLGE2e5eszVmpVSvgQwxbWObdWyQUmGgibJBLmXvKUL3kyn/473MUz+POVttU8c72oxedDVRT5fjMd+DIvGal0M0io6AP7si9Qr0/r8TLfUwn0S9sWC1SxhPwKe4LzqBz36ECK4HeH9ja2TaBuNiVgo1X5kcY9CpHuc34t3RDhvK6zWaYnoHXzGTkkh4FJUktP0zxl7/nYrNJWlwvAOuK673q6F4A7oe9NPiAMFVQgEfa49gwAxvBe/cB3yJjTAm4Fin6H9MXSIp3lKgRRJuk4USxx1Gb3SnmS+uhcnDMh8pMFhjjbF1wBOKEpV0EOuH39SITm//4REJI7Xmfom5lQ2oAAl3WEQ3vXHb9ZcuIgtpJzfOj6ES9MSziAjdQlxt2CLnUNqzcZAS/kXeM15mtzGCEz9qvI55iq2C0XVoyHHGwB0aYmgFft1hZIqq2ab7wF7v3iyfviDKVXC7jtHnQCBtn8hFhFHIq7M/1hzpxEeUtBLELraOeNHhgWPSfM+/t0h+FQHxV9G4W8F0EV6BBQZa1kpjbS5PytveXUvkBnQWhE+oFMVgOttaHDemFQX9Xs6raAaVvvGIDqjkEHb8dmR/0RrUiOqBGaRqDfG+5VQyOMBllP0k96bZgvLv9rQpj7Td1FXqZnVx/6d4OThMjPBB/npA7sqJbG4Yf7ViajJqk2APhH155dLxjE9nWRXQD1jz+aIiAWl6mBqdSkSdJypp6L7FDClpBVFTL/5Wg8YS0Tza/48A881eaksqyWMz05g3Pd9RvMEw+Zd3st6xnnD1Ld8kTsG0lFXk2rL3/ RPyobqrx Uai5XkK/WdSAFS58JOkK5x68Zg+DSdP09kasQrABHObo00CuQYz9QPn/0nIWFeCVxWFVqEpslI79IHDZKEfCtlPwwUhzXdMXsepvaPGj+zeqlBxQ2Ib9kFThAHAaeBeTOTZdslV6Q+b5TJYdt8PyJwrWkAGfy2i32AbfOMq/vx9turJGm9wuGeYU8vnWrU4TjUeEDxGZotwUWitHNwPQn4r5OBO64nJAGXQO6BVCj8pe98hn/DXGwMcmw1pHss7q3vuhJqWAfmV9KvjjS6gUddfAf/monzBMA2A2Le7ynwapC8FLOVDhzqGeMtwKIOY+qb0yS 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: We have compact_blockskip_flush check in __reset_isolation_suitable, just remove repeat check before __reset_isolation_suitable in compact_blockskip_flush. Signed-off-by: Kemeng Shi Reviewed-by: Baolin Wang --- mm/compaction.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index 8d7d38073d30..d8416d3dd445 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -434,9 +434,7 @@ void reset_isolation_suitable(pg_data_t *pgdat) if (!populated_zone(zone)) continue; - /* Only flush if a full compaction finished recently */ - if (zone->compact_blockskip_flush) - __reset_isolation_suitable(zone); + __reset_isolation_suitable(zone); } } From patchwork Sat Aug 5 11:07:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13342474 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 02A9FC41513 for ; Sat, 5 Aug 2023 03:07:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5763B8D0001; Fri, 4 Aug 2023 23:07:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B14F8D0003; Fri, 4 Aug 2023 23:07:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 23EBE8D0001; Fri, 4 Aug 2023 23:07:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id ED4928D0001 for ; Fri, 4 Aug 2023 23:07:07 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C0F7B1C97B3 for ; Sat, 5 Aug 2023 03:07:07 +0000 (UTC) X-FDA: 81088564494.16.4162CB5 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by imf29.hostedemail.com (Postfix) with ESMTP id 968DE120015 for ; Sat, 5 Aug 2023 03:07:05 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; spf=none (imf29.hostedemail.com: domain of shikemeng@huaweicloud.com has no SPF policy when checking 45.249.212.51) smtp.mailfrom=shikemeng@huaweicloud.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691204826; 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=3s7tC4jnWijTGwovFlPyZOZKXQlPOjFb94YEx7hM6S4=; b=0vV/rYnG1VIrW79jQXkjFJvGGe2hvMK+K+WmAnJln9NNGGQ3CGN7Sr1XgNievk/DRqd2um FAFQgHrBbVGXn7+TmP/JEI8iln6mFhlneODN5EJPNLbAoRXq5tBWZ8diAB4KXYnJzvQQpI Y1e4+4IQB++e4k8JJerMjS0Qg+R8+go= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691204826; a=rsa-sha256; cv=none; b=F5Es2TarUT0JfbMsGZwqwfD/G/rI08qf0BD/C0o6T74W1cOMLz3ViKfY8r9m1XCSCQYiJj r2odbjHN+3Z0yxdze3WXmgp/z26oU3809vETRQpUG+kWKLVY+8EUABVD4vRSUBDZ2PU4/E mwoUecEvrcLEVAVObiRBHffPn3I2mZA= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; spf=none (imf29.hostedemail.com: domain of shikemeng@huaweicloud.com has no SPF policy when checking 45.249.212.51) smtp.mailfrom=shikemeng@huaweicloud.com; dmarc=none Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RHnYb6vNcz4f3jqj for ; Sat, 5 Aug 2023 11:06:59 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP4 (Coremail) with SMTP id gCh0CgAHvrHQvM1k6A5ePg--.23962S8; Sat, 05 Aug 2023 11:07:00 +0800 (CST) From: Kemeng Shi To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, baolin.wang@linux.alibaba.com, mgorman@techsingularity.net, david@redhat.com Cc: shikemeng@huaweicloud.com Subject: [PATCH 6/9] mm/compaction: rename is_via_compact_memory to compaction_with_allocation_order Date: Sat, 5 Aug 2023 19:07:08 +0800 Message-Id: <20230805110711.2975149-7-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230805110711.2975149-1-shikemeng@huaweicloud.com> References: <20230805110711.2975149-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: gCh0CgAHvrHQvM1k6A5ePg--.23962S8 X-Coremail-Antispam: 1UD129KBjvJXoW7KF1fKF1fKryxJw4ktry5Jwb_yoW8Xw15pF 10yw1xZ3WvqFy3GF4Iya18C3W5Gw4xKFyUJrs29w48Xw1ak3WFk3ZrtFyFvryUX3sakrWY vFZ8K3WUt39xA3JanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPY14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2jI8I6cxK62vIxIIY0VWUZVW8XwA2048vs2IY02 0E87I2jVAFwI0_JF0E3s1l82xGYIkIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0 rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6x IIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xv wVC2z280aVCY1x0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFc xC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_ Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2 IErcIFxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E 14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIx kGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxVAF wI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r 4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0pRvJPtU UUUU= X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 968DE120015 X-Rspam-User: X-Stat-Signature: 5gnyo61qmanncs5pj89woimcx8ip9rhm X-Rspamd-Server: rspam03 X-HE-Tag: 1691204825-620688 X-HE-Meta: U2FsdGVkX19HlG/Smd7PW4nkqupNjFoLUtgsTEGiZrWDSACJJ4wvvDZc/NEWmBVHOkrGeV8e/20lPW7nWr4Q/gcY10+gh7sg2/B4I7qj1tAMAo+PT/Jjehldenz6WckywxMJS0ypxIZNLI6nYq359LAfzZvypd2LvLfPzlxKEzTLO+cCLqang1r3ZKn/Cty9A6s+A35Pky8vlYeRYiv9BmT7ZlIds8Q8siGVsepdlRWOTGlzkn7+3AayiTSCqactT2kmYdxyM5b4+Yov/TjiZET6HLHYq/ZDz3UDpar8S7h7Z+fNHmRuZrPvn9cFdV9j1l3E2K36Qlg5ssgPtU3ZUSdjje212kHQwFtTCLL0B+9JNQQJFPPMk8WSWzEp83xmWCYOuHMJMT1dhxguutGz1UhmwmRWDVsZSD2+5zbD53S7vK48DF1WUuhePbZlSMIiNnFt2vc+ZJTV1TKdrxRPPsGAFPSoyWJw67zl+QbziCeDycgXfpYirxvbIsuzpfOs9GfAJm7rxYiiQXqXw3vzDnNcP5vFwBtf9iwFdm10RRlaGRSe7jC3rtni3VmRFZV1sUic1lv9FdEf3razod/WAyk7UlRTHt+/ldAYeARYyJdyNWOwXxax4nDDAeTi61dTGEVEKnVm7hJg16W5xzEvtkZnDSE5p1bZSkCFoc2kdDWn8vSb8WWnBjx2Ymc5nF3om7jV8xLRVdkt9ZaUpkEm+VcmZ2Pd1ediED8qZ+BmrGy1Z9ZLOV/v0V37nh6DZCW1hs1n8bT+jCPummQMB7xtibmSJhje73UlrmzQQTl8NNobSmEhSVbpobZ5y40L2TRaqMJG64iObRNzksqy45ri4RffEOpbSWLuW2nkgNUEBhpLn9vecbnhHOQGcbdnqdGvd1skkCYGoDRpoTnigOLIgKUOjFhTGPa1omD53zwO3xd/RupoDdHn+qLpbfxSdm5MazSxEaoKdqhSQI9thu/ KlueN5Hq /AgZH0EfOcle7VBHBrrTML0PnL3NQupPltzA9IpmFjBWKD5FANJtUmkvODIiSiuGEUEbWXCY+x6RNfB6N+szuKQKzN/pQwp3KC5AQxP+ai73+d4l24Ry2ca4YCAl1PETWg7lOcyTqDceCCXxDgEe8YjNQeU6t+zEfFgJFzahAWnCGLkSdOhAR/U4c6FyfYjUYPdJXtg4oHytiSEVT0L5vdOG8J+sI9q+B1Ic1Fdyj1aNCjKQk21AVmNanD3p0S+E+iK2PJyCa5oMdk8g= 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: We have order = -1 via proactive compaction, the is_via_compact_memory is not proper name anymore. As cc->order informs the compaction to satisfy a allocation with that order, so rename it to compaction_with_allocation_order. Signed-off-by: Kemeng Shi --- mm/compaction.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index d8416d3dd445..b5a699ed526b 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2055,12 +2055,11 @@ static isolate_migrate_t isolate_migratepages(struct compact_control *cc) } /* - * order == -1 is expected when compacting via - * /proc/sys/vm/compact_memory + * compact to satisfy allocation with target order */ -static inline bool is_via_compact_memory(int order) +static inline bool compaction_with_allocation_order(int order) { - return order == -1; + return order != -1; } /* @@ -2200,7 +2199,7 @@ static enum compact_result __compact_finished(struct compact_control *cc) goto out; } - if (is_via_compact_memory(cc->order)) + if (!compaction_with_allocation_order(cc->order)) return COMPACT_CONTINUE; /* @@ -2390,7 +2389,7 @@ compact_zone(struct compact_control *cc, struct capture_control *capc) cc->migratetype = gfp_migratetype(cc->gfp_mask); - if (!is_via_compact_memory(cc->order)) { + if (compaction_with_allocation_order(cc->order)) { unsigned long watermark; /* Allocation can already succeed, nothing to do */ From patchwork Sat Aug 5 11:07:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13342473 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 77392C04A94 for ; Sat, 5 Aug 2023 03:07:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 242728D0005; Fri, 4 Aug 2023 23:07:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1F2A18D0006; Fri, 4 Aug 2023 23:07:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0913E8D0005; Fri, 4 Aug 2023 23:07:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D085E8D0003 for ; Fri, 4 Aug 2023 23:07:07 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A067A1A033F for ; Sat, 5 Aug 2023 03:07:07 +0000 (UTC) X-FDA: 81088564494.18.DA037B1 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by imf08.hostedemail.com (Postfix) with ESMTP id 149A0160009 for ; Sat, 5 Aug 2023 03:07:04 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=none; spf=none (imf08.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=1691204825; 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=L25XJYbeGeYoEl8Y6AyBg6f6iV40zJxwNT5EL9bqX58=; b=hej1F944VInPPzuUG8kzda3v+K/itPBI9FJIkSNDLrjP3XJXwkhUub6O3uu7laa2BZUfRS xOoVpnt/cLaN5+A36D9avGwVZECHodgGXPxCpfWlC+oAZTViwA+R26ep/i4AoYVR0PKFT1 JaeMX9HArl4CVQ3fv4tzZyPpf4ljFZs= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=none; spf=none (imf08.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=1691204825; a=rsa-sha256; cv=none; b=prQUiFKmsUwmJXjrM+OA6Ps1KJdDxAZb1dslCdiY3RsirSJoBlMj826YU/pv26PnI7l7Nl LfIpiu0Y5Omx/hTmJNXyzCclkVNzqSUfaIkneZ7lUcs2fv3hPB8I1fUJY1HSroHATz4r5Q 8vdcmo9XaSea6/sHvjsyqWi1M3ratow= Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RHnYb4ybVz4f3nKW for ; Sat, 5 Aug 2023 11:06:59 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP4 (Coremail) with SMTP id gCh0CgAHvrHQvM1k6A5ePg--.23962S9; Sat, 05 Aug 2023 11:07:00 +0800 (CST) From: Kemeng Shi To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, baolin.wang@linux.alibaba.com, mgorman@techsingularity.net, david@redhat.com Cc: shikemeng@huaweicloud.com Subject: [PATCH 7/9] mm/compaction: factor out code to test if we should run compaction for target order Date: Sat, 5 Aug 2023 19:07:09 +0800 Message-Id: <20230805110711.2975149-8-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230805110711.2975149-1-shikemeng@huaweicloud.com> References: <20230805110711.2975149-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: gCh0CgAHvrHQvM1k6A5ePg--.23962S9 X-Coremail-Antispam: 1UD129KBjvJXoW7uF1rAw47ZryrKr15Zw4kCrg_yoW8Kw4xpF y8Z343K395XF13GFWIya18JF45Xw4xGF1DAwsFqwn2vw1ayay0v3WDta48ZFyUXry3Ar4j qFWYkFyDKFsxAaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPF14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2jI8I6cxK62vIxIIY0VWUZVW8XwA2048vs2IY02 0E87I2jVAFwI0_JF0E3s1l82xGYIkIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0 rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6x IIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xv wVC2z280aVCY1x0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFc xC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_ Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2 IErcIFxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E 14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIx kGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxVAF wI0_Cr0_Gr1UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJV W8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjTRKfOw UUUUU X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 149A0160009 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: htwhg6e8atbbx4qg4p77qcfzdsh4timg X-HE-Tag: 1691204824-547584 X-HE-Meta: U2FsdGVkX19oRcS5c+Y6IWQZzI+ldzhInKZrSI28HBEZZCz82wsiMpbJJlWbKq+RC9mGGOkhNlOiRfaYRGkzxH+Jvm2KdpW2DeppHdOkHVliEQjbAOJX3Xnaob6Vr7B7fc5mpsJ2svaloEKYFzXM1tr9bkQIpE6SvkdFssKAN8tbzR1eYxHj+AhHmd+kvQvfH9b+qC6QgdYBCxqZWmZJdPRQV0/zmNO4p/UkqZbCuDo/jnQ2CL08FllyrWCDA++hOQsyv976pGVKFI59yrS9OnFt2RD1jTuQAB/IeDoqZ2lTQuQnKxfZR5ho6z0SVjDfUN58aeupBw97haqbzFp3WqfqGu4PmNWUidEAPcihaxlbgCvNKgsPRdGUmhzGgeIzjjzvSe0rz3j3D6inVGW4U1G0WkgjfREemnKpt1+BP1VCipp0IfxZjwKVTDtGHdhnIUS6L2FhMX6iUSLVhijSR4oSIch4bSnpzhikEvOy7gkB0Sar9h2WdKFhbqO5y36q9ZneCcmZWFUTk53NEJfTHefbEWvAn/MsdR48q7pCyQDlsK0II142iAC+JkrYmy2DHguMI1HRnJSQXn7E6fi8H6pb3hWN6KwCo05l7Lxj5FVnc/Z373ef/Qa097RyqmIXynAAA3WWS38flP3RJnN8cO1dw1DYq0Kh561pTL1149IUEnf4rMMOWnlhtgJOBQMUUOs5+5cxEHCyP8DzlQaKNg4YA3Zvf4/MfrXdPij8aGJTkS+q5yhaayVh8VKF6Vn+9kd6zBFdjQf1VRO97YFcCzAMsTHcG3mPrea1tSEJwZRXOEr3oib7sP/jSmiWs294OIMRy+1tUFBSZre690bkwgz1Nbcy9AHm6KBwgoSXJgdyKR2dwO+PoQCgMQL3wDa8WAMvL9fXQBCGQ3Aki3aoTlF1TJR1dEBwsgWeHqR+SYE508KlRWhMP41ZJvid5B8RDPkhg2K6WK/YR5Fc12q 5CfaBHVp kREEkgMFEQttkd3JoNvG0jjiU9q92yti1k5X6q37v5DHtMA3SUidLthfrm7ufS3aLGkDBQyy6EFe/6+tSsRElKpJNrpT6ulD/Nwo+ZGletPZhkGtOzqWWk6HOlnbeEji3jrCHiBjr3wJgomEWC6l+96POUw88dcoKvjqjY1QU1VPKfpr2DxwnmYFzIQN0Ywka7/EBTSVQG40LFTUPSYGy6wYpLslTGC+3j+d7Vpl68zGlqTK3P0gmDH80ELZgyHnzx19xyGogc88mBqLNLcO+sPZlWkYxn/+ROQve 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: We always do zone_watermark_ok check and compaction_suitable check together to test if compaction for target order should be runned. Factor these code out for preparation to remove repeat code. Signed-off-by: Kemeng Shi --- mm/compaction.c | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index b5a699ed526b..26787ebb0297 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2365,6 +2365,30 @@ bool compaction_zonelist_suitable(struct alloc_context *ac, int order, return false; } +/* + * Should we do compaction for target allocation order. + * Return COMPACT_SUCCESS if allocation for target order can be already + * satisfied + * Return COMPACT_SKIPPED if compaction for target order is likely to fail + * Return COMPACT_CONTINUE if compaction for target order should be runned + */ +static inline enum compact_result +compaction_suit_allocation_order(struct zone *zone, unsigned int order, + int highest_zoneidx, unsigned int alloc_flags) +{ + unsigned long watermark; + + watermark = wmark_pages(zone, alloc_flags & ALLOC_WMARK_MASK); + if (zone_watermark_ok(zone, order, watermark, highest_zoneidx, + alloc_flags)) + return COMPACT_SUCCESS; + + if (!compaction_suitable(zone, order, highest_zoneidx)) + return COMPACT_SKIPPED; + + return COMPACT_CONTINUE; +} + static enum compact_result compact_zone(struct compact_control *cc, struct capture_control *capc) { @@ -2390,19 +2414,11 @@ compact_zone(struct compact_control *cc, struct capture_control *capc) cc->migratetype = gfp_migratetype(cc->gfp_mask); if (compaction_with_allocation_order(cc->order)) { - unsigned long watermark; - - /* Allocation can already succeed, nothing to do */ - watermark = wmark_pages(cc->zone, - cc->alloc_flags & ALLOC_WMARK_MASK); - if (zone_watermark_ok(cc->zone, cc->order, watermark, - cc->highest_zoneidx, cc->alloc_flags)) - return COMPACT_SUCCESS; - - /* Compaction is likely to fail */ - if (!compaction_suitable(cc->zone, cc->order, - cc->highest_zoneidx)) - return COMPACT_SKIPPED; + ret = compaction_suit_allocation_order(cc->zone, cc->order, + cc->highest_zoneidx, + cc->alloc_flags); + if (ret != COMPACT_CONTINUE) + return ret; } /* From patchwork Sat Aug 5 11:07:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13342476 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 91C6EC04A94 for ; Sat, 5 Aug 2023 03:07:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BB7DF8D0007; Fri, 4 Aug 2023 23:07:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B40DD8D0006; Fri, 4 Aug 2023 23:07:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9BF7C8D0008; Fri, 4 Aug 2023 23:07:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 8AFB38D0007 for ; Fri, 4 Aug 2023 23:07:08 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 59C1A1A02C0 for ; Sat, 5 Aug 2023 03:07:08 +0000 (UTC) X-FDA: 81088564536.14.8FD4C0F Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by imf28.hostedemail.com (Postfix) with ESMTP id 3AB69C0006 for ; Sat, 5 Aug 2023 03:07:05 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; spf=none (imf28.hostedemail.com: domain of shikemeng@huaweicloud.com has no SPF policy when checking 45.249.212.51) smtp.mailfrom=shikemeng@huaweicloud.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691204826; a=rsa-sha256; cv=none; b=7AKxN55MPY65/w4nNfMTk3tKmvs9jp8QqxiFkNJHXZfmrbg1JyHBYcRCLZZDTuNohN3wEB ZWtofFoTvHL5gjLoOHOdToIKy5+IAiZ3Vd0YtkDvpyqDIPKUdMYW161LeZ9l+DxJExyckj AqIr7Hky1fOBD/8wczDSs5zsue7OhN4= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; spf=none (imf28.hostedemail.com: domain of shikemeng@huaweicloud.com has no SPF policy when checking 45.249.212.51) smtp.mailfrom=shikemeng@huaweicloud.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691204826; 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=KLsFy+v4yVmbzWqz2R32IBuN6RqkZlHIng/lQs9O/Vk=; b=zZjYK+6FSpvUNWcTtI6T15CiabtK0DfS3u7bhgsCPFZxKnbNvoCK1DUVRLWhLxHsCfKl2/ kbrc3wpLYOz3E4VabPExsW6MtOiMlwzd0cSuN6bYHxbrrUw5UipeU9RlGOXH5iu3SimId2 g68Lnn+VfNGOn4HNg2HG3BWmxDRkVuk= Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RHnYc3DzWz4f3nTY for ; Sat, 5 Aug 2023 11:07:00 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP4 (Coremail) with SMTP id gCh0CgAHvrHQvM1k6A5ePg--.23962S11; Sat, 05 Aug 2023 11:07:01 +0800 (CST) From: Kemeng Shi To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, baolin.wang@linux.alibaba.com, mgorman@techsingularity.net, david@redhat.com Cc: shikemeng@huaweicloud.com Subject: [PATCH 9/9] mm/compaction: call compaction_suit_allocation_order in kcompactd_do_work Date: Sat, 5 Aug 2023 19:07:11 +0800 Message-Id: <20230805110711.2975149-10-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230805110711.2975149-1-shikemeng@huaweicloud.com> References: <20230805110711.2975149-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: gCh0CgAHvrHQvM1k6A5ePg--.23962S11 X-Coremail-Antispam: 1UD129KBjvdXoWrtFWrKr47ur4UAw17tFW8Zwb_yoWfXrc_Jr 1xAF4YvrWayrykWr4qkr4SyrW8Gw48Ar1DJwn0qF42yF9Fy39avw4DZFy7Zr15WFyDCr9x ua1rXa4DK3W29jkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbDAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M28IrcIa0xkI8V A2jI8067AKxVWUAVCq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJ M28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2I x0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK 6I8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4 xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8 JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20V AGYxC7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAF wI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc4 0Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AK xVWxJVW8Jr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r 4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0pRvJPtU UUUU= X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 3AB69C0006 X-Stat-Signature: zdgao6q6g3otzgjfdxhrgkptofqmpi9o X-HE-Tag: 1691204825-387171 X-HE-Meta: U2FsdGVkX1+2p1TaMp1RaseFjbSRT09MkpGsM2Yzaztzyddd4jNksAeDfxFeawoD68A1qlKRNtzuufrjwQpwFOyAVucVWn8tCua2pibKbIKwRohkhDxMK31PbAIVjbE0ktfOI1TCXxAK6sSRvsaMCbbgYXJjQajvou/VzczOu5ORehxHNyNXC1YMArXJ59Jjw5StnGtoK2nLKPK/EtH+UgGrZ7GQo5vrrpePh1TCmexucZQzZtfOD5q7GkkCDKDFMVpytym5BpT7AkfIIBhlzp9tnviDz6i8Kejm1VY1c3ErMaxpBR3sfATi6W/Mo8x/H09E9iqJNvA+2Mse3c4B53Zt2pE6ur8ukpLuqPV2s53RpxdKR/a+vaKE27lBUKX+8/IVejkS+CeKiYWGbDk0gx/OKptAVj58sNuArtGZCPP2dlpEqjhtSFLb7tfTSMDndFXtHzPBiPF7zGLw9vu63V7HOPppFDcc7/jeBIkJN/GaAH9jIGJ6Mhb8yaikBOgaX49zLzBWtwm1x35PVd5XHdNwbQzbJG3ZuGCiLap7EX2H8BshmijFtaOXeEo7+0vUBga6Oscr3H+KzFOUkZ7lJ5goLgeM9NN7k5bjXosf1WdbsUKrStTdf4NuHtK77lNGY/U0DVkuNSMzHVwJWnl6TrSxFZKRpVEaEo4nhPfHpcLJGWIM+612EqQptySAhI1UEZFMh7yoRacKRU6c3tcSf8t4RkNHfD5g058994yHnCWyIxugCYVSJyggrYeH9u5iwXJE9YCpYklQoDyD1IrBpBtihYycDgZHKCi27zksx8O7pBmBdMfOqY2SucHLCvgtuqzQOX9701nnLKQxMCxAGf6w+fEMR4SIqBxIF8Sc3zBbVoUVbIl3GgSucR85iGNLJ1EZP3xIiCwuQYpZGfxwir7+YQsvjayktgDLYGian0CrgMpbbQAUKSYYOWxqLtmJ0K8wbDLk6kT65eDQJBU EqprtC+d AJ+TYXw8gox2G1s/Ahm0Mb6SUybAV2eFnXX3E6P6BCvEloKXJGhIYf7Z0SA999wEICk89qeJ7GM98eiKBXRwQJhKfe2yG39d3/AzRRvdqciqlZEXzbBDwxqxAahw7/h3D5vabfRU5WTJqSNRhDNIsUnOIpJi7ZxltVZNudX6e6gOMIhfPFYlXwzCwBnlfUhJRRo2TFelWiDO87aMLIRP63RGCSaoAGs+33ZZAlt9siFua/Q475f+9VTu0ZXGbrXWKTf+2T/tzii//TJY= 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: Use compaction_suit_allocation_order helper in kcompactd_do_work to remove repeat code. Signed-off-by: Kemeng Shi --- mm/compaction.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index f4b6c520038a..05c27a1ef68a 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2963,12 +2963,8 @@ static void kcompactd_do_work(pg_data_t *pgdat) if (compaction_deferred(zone, cc.order)) continue; - /* Allocation can already succeed, nothing to do */ - if (zone_watermark_ok(zone, cc.order, - min_wmark_pages(zone), zoneid, 0)) - continue; - - if (!compaction_suitable(zone, cc.order, zoneid)) + if (compaction_suit_allocation_order(zone, + cc.order, zoneid, 0) != COMPACT_CONTINUE) continue; if (kthread_should_stop())