From patchwork Tue Feb 14 03:18:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13139321 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 EACA2C6379F for ; Tue, 14 Feb 2023 03:18:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 79FEF280001; Mon, 13 Feb 2023 22:18:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 750046B0075; Mon, 13 Feb 2023 22:18:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 63EDB280002; Mon, 13 Feb 2023 22:18:33 -0500 (EST) 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 31CF0280001 for ; Mon, 13 Feb 2023 22:18:33 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id F1BC0A0939 for ; Tue, 14 Feb 2023 03:18:32 +0000 (UTC) X-FDA: 80464439664.25.2F2E92C Received: from out30-112.freemail.mail.aliyun.com (out30-112.freemail.mail.aliyun.com [115.124.30.112]) by imf09.hostedemail.com (Postfix) with ESMTP id F17A8140002 for ; Tue, 14 Feb 2023 03:18:29 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf09.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.112 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676344711; 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=Sjacq73LysBunDj3uA7blBQG5dY12pCqzz30TKH/Lho=; b=BUpxs5UIac7Pn7lPoi1ZR14wXYESyox76yR+IHuSTPtwpGUq2+rrpP3Lh/z122NmstjGY/ Ei3Nyr2ymM7wgbvoize/KndHE3p79Jdf1JRJprp/ed9stHT8ckkeVyZYl/LSXD6Np5nQvg hb3p4jnoSOZ7vL6GoB8oV34OeEJWxsk= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf09.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.112 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676344711; a=rsa-sha256; cv=none; b=Q0TG1tC8qjlWjJWlbQTU7EuA1zwU+p/Kwhpj9BRknk/n3DwoWK8F3P6IVqA7N1CmBaMoPk q2opB/TIMloWA+nbPTQwTluFJ6UeZU2ZmVadDflLWen9HHFD5ekmM3VnDIUpekxhYiSVUu APMAHtyQ3QHIxHBoWATIfnzwYUa3mls= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R331e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0Vbe-fy8_1676344706; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0Vbe-fy8_1676344706) by smtp.aliyun-inc.com; Tue, 14 Feb 2023 11:18:27 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: torvalds@linux-foundation.org, sj@kernel.org, hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev, shakeelb@google.com, muchun.song@linux.dev, baolin.wang@linux.alibaba.com, damon@lists.linux.dev, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] mm: check negative error of folio_isolate_lru() when failed to isolate a folio Date: Tue, 14 Feb 2023 11:18:06 +0800 Message-Id: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: F17A8140002 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: 4o5fbkqhp9597gigf6mmba8gjbmidku3 X-HE-Tag: 1676344709-875315 X-HE-Meta: U2FsdGVkX19ozHSLAtxABsRjHHFtJH2U4tzGtZCEHLXaKGprxtuwOfA7cgf+Wp6hQvB0IJKwI4EIXDBPClNmfL71S3Qw6Bm3+WCeaAk/RVu1costpQI38COV6TLUXOKnT8cs3woJ1Xwe3tZcrTYyeuNv/1awcEI9Lo0BUIoSeMk34joEe6j6j34j6e/e+iBuxporpUk2oZY0KGK5DMtO1mkh2GtbhW0y41hILDVBiVAh0484YBJOoiVpNlmrinkV+/TQig2w5Golu1O9ICYlPh17n6FYlzugBVwQgMyb4cQtf8KtdqAKGYQ3uQq9yZTEzu83GCW0oSmcXO/a/ou73Xgr2sR8zU0ju5ZlJt+k1Qu/ik9UtfEDTZKgd6Vu91kWfbRZB7iUYm5IFmCJ2Dk2XR1VCuvzGCL3iDZeViWO2E8la6dGfuvn0IxyMtq5D5O7yAE+sjtpqYso2VkB9HY3kWIgHCv+xqaM4mdYQP+JLRIZZSOLz7IKijyu1cosKxVNvwuo7TLhjSlekb0haLYKPcrbkIgBRfnhnloW/bZsdUC0bv8K+ee7j2vukFywEeiuRNf7K1jiq2B+kod6ZjvXUz9XbCjgrrPqbo55HHZxlG07zFlpVAYAYEMy7vHZgKe2HtxMx+PiD8UILKH8T9ccR6fOIyi27OXR7fMEwH4cTrQeljkgCOI9mYBsXc5RDx3QIdVx8s/JAHCkw/ulrTaW14zL1yMS5KvPRyUZmuOFT0Y+D3OwNsYsNOI9sRmgcmLQGCh4rYPLn6XMx0E35F/RTyIDk6T+hStLqa/48aU53xPKLuHk4noDOQniuuyu/cEe04XHVSk6ivgi9cRsCcZc90ZjgWf7twLV4GCl2izK4/Q3EARh0p+AgO88iDsvxKrGtBQBWerrISYUTrlpZCYBKxi8zmmA/xI3BAeRebjWAy4BAftJhixf7S3/oFx6AqpvDQX5SL3mOyhm1HuQDvY 6mhCc++f X2dnRWgvQWq86xDG3Y9di1jDAE/qvkyx1ri7PpAxc/5Qg8dmftKllLrl84wwrb8/D8zSHUO8o14pOVPbSe1kMEMPkBZz1/t11abYCjKIRhnHb+93jBL4oLTgumA+GKi94Fv3Jw2fOsWchREuRv35211mj/cTSklbXTFuajF3QJ7a1aHc33KsSyjYdrMeg4/5Q7Vgy8kjnhmVksPP2uIyonFiaE0cbDU/7uG3VlBvORLKsP0QIycXW4hh4pQ== 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 folio_isolate_lru() will return a negative error if failed to isolate a folio from its LRU list, thus better to check the negative error to make the code more clear per Linus's suggestion[1]. No functional changes. [1] https://lore.kernel.org/all/CAHk-=wiBrY+O-4=2mrbVyxR+hOqfdJ=Do6xoucfJ9_5az01L4Q@mail.gmail.com/ Signed-off-by: Baolin Wang --- mm/damon/paddr.c | 2 +- mm/gup.c | 2 +- mm/khugepaged.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index b4df9b9bcc0a..ebf3dd084af2 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -246,7 +246,7 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s) folio_clear_referenced(folio); folio_test_clear_young(folio); - if (folio_isolate_lru(folio)) { + if (folio_isolate_lru(folio) < 0) { folio_put(folio); continue; } diff --git a/mm/gup.c b/mm/gup.c index b0885f70579c..7fdddd43663c 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1939,7 +1939,7 @@ static unsigned long collect_longterm_unpinnable_pages( drain_allow = false; } - if (folio_isolate_lru(folio)) + if (folio_isolate_lru(folio) < 0) continue; list_add_tail(&folio->lru, movable_page_list); diff --git a/mm/khugepaged.c b/mm/khugepaged.c index a5d32231bfad..463dfca4b841 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -2047,7 +2047,7 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr, goto out_unlock; } - if (folio_isolate_lru(folio)) { + if (folio_isolate_lru(folio) < 0) { result = SCAN_DEL_PAGE_LRU; goto out_unlock; } From patchwork Tue Feb 14 03:18:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13139323 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 2A0DBC636D4 for ; Tue, 14 Feb 2023 03:18:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 69188280003; Mon, 13 Feb 2023 22:18:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 61B2B6B0075; Mon, 13 Feb 2023 22:18:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 46B10280003; Mon, 13 Feb 2023 22:18:36 -0500 (EST) 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 2D5FE6B0074 for ; Mon, 13 Feb 2023 22:18:36 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id EBF0EC05B4 for ; Tue, 14 Feb 2023 03:18:35 +0000 (UTC) X-FDA: 80464439790.03.0AE9194 Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) by imf12.hostedemail.com (Postfix) with ESMTP id 6D56B40003 for ; Tue, 14 Feb 2023 03:18:33 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf12.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.119 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676344713; 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=+roXL7HgZQYWOI/UHpiNDGpxvt04oLVwFQx9KgkpYVo=; b=rixgPu6gZA+aVmjb7S9GcT9+C45HU/ZVhe0UEsTKyAAX2XPC/8NnO3mekpBLOVp9bWWR+8 /CvNRELdSRCnbvp93oro7ef90uhpVGienoJKZJcbrFmvo1BlaSRT8yd7kAiRAO4Q51A+6s C4hP8ot8fEytqcm/RJa2Gb3w1ybKiiw= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf12.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.119 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676344713; a=rsa-sha256; cv=none; b=SRrz1QgpY37TDEROlu60MfB+e7zNYY4Bl1EI4zEN3JgYZAY38Nkto4TO5s2MQcqwQ+j+o2 /i2f5bosSNgLimbRFhQ0wTaFnGJCwk3WklutVHIXwksd3Kx/JzHBq61ZJmNs2VUk/No63M KsqvjdYO3q1Elmpq6Y+QBVqOMHbYpqA= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R851e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0VbdtbCV_1676344707; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VbdtbCV_1676344707) by smtp.aliyun-inc.com; Tue, 14 Feb 2023 11:18:27 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: torvalds@linux-foundation.org, sj@kernel.org, hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev, shakeelb@google.com, muchun.song@linux.dev, baolin.wang@linux.alibaba.com, damon@lists.linux.dev, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] mm: check negative error of isolate_lru_page() when failed to isolate a page Date: Tue, 14 Feb 2023 11:18:07 +0800 Message-Id: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 6D56B40003 X-Rspam-User: X-Stat-Signature: q7bf6b9n8egrhuwhc49czbzqqdkmabug X-HE-Tag: 1676344713-187025 X-HE-Meta: U2FsdGVkX1/KW4AEkmcx8sGXlCWQOqU5Socs9yqlnyuSwPeFwZRfrgqLocl8Q3GudGo2q/HVntb4/2z7Z2Jaaui0b0Aza1ghDGBaSjj15yy1vAtpazp8mLuBOHQmHXMh/caFVmgAS5fgSvePJGs21xnvc2anbIkY9eomUeYbBv/nWQsMGV1teBLAmjdz20ur7JjZx62CPvd3a+stK8CMlBAOwxEDvI17ee7GvwXXDM78Uk2LL0hKAeLis/WR0FwXEGq9sK1rPHg2pR9H+w8soh/Qh1vBzQrQ/2govkpw1Zw7ZRiUNekfUstW7B4EnXUZZDuPwwXcIwHFSyBug/MS5099nv+MHcH+l25sXyijJAMLQBaTjYketMsSvw0FY4ls5/q+1FEMqTi8MQE+TQbehpLy6k//S14GHQhl5nzcXdlgdwx7EgpFKn4wrBaochqg1lHNYtV7fAlBhRLSEXxAtjATQgAEynx8qR63QFQM3uQWXzn+gx8PRDFSm9pHJI3BXDJV4v+teXXWgn+4ohZ0Srt3VH2sJsHb2vv8H0zgP40/eutcwUGRpKr2uid01mdZ6akin/VjE2ApbdKRxWvFwshuKmhHH08J5oz7/DCSabeKoFeC7oR6COnhkChiaFNqjuzzgatny4L0dMyWXlRe1n+UMYxVCrjIj9JZgmEj9UCBvUhIItcXHTqyB+SEp3YINbKjrSlhi43H4tR1CFjft6GaS6+P4EAs5n5l1BQb5fUHpW0TknLz6XC+PF4KUUOUZ/EmP9+dtEijwoQgcLRkn1/Gd1h67DPvm2rw0PF0w9wkF67boZc7mRLPjwVoKb3AU9xIzsh8pMg1TavF1xw5K4kVO4rGj+silgvfO99HwBSxAysF8XcjMEJG9co4KH+IS9HMbAVRZJ9vht6ehVZytmIY0DSsmn3jyeoPDvvgs9TVo2WOm6leFkCuoGzR+k9KVSyQO7gkYdzNoK2QcJ1 aRxY+ZEI kcXWcZa52ueSW6GgxeYCl4CUxJSAqpC4LNajZO/FrfVV7IluBiWv6+kpXgT6plZlhg7ECXvW/jJkbZg8oZTxYRdwIYcxNmRYceCGX5bP0NmLJ0LUBfys4wunjWfklG7hiPs0ZzLGeznZwmQlw4EDzb5NOFxWYlJAs5JwO 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: Better to check the negative error of isolate_lru_page() when failed to isolate a page from its LRU, which makes the code more clear. No functional changes. Signed-off-by: Baolin Wang --- mm/khugepaged.c | 2 +- mm/memcontrol.c | 2 +- mm/migrate.c | 4 ++-- mm/migrate_device.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 463dfca4b841..99a2d993b51c 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -659,7 +659,7 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma, * Isolate the page to avoid collapsing an hugepage * currently in use by the VM. */ - if (isolate_lru_page(page)) { + if (isolate_lru_page(page) < 0) { unlock_page(page); result = SCAN_DEL_PAGE_LRU; goto out; diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 17335459d8dc..33cad66a4132 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -6226,7 +6226,7 @@ static int mem_cgroup_move_charge_pte_range(pmd_t *pmd, */ if (PageTransCompound(page)) goto put; - if (!device && isolate_lru_page(page)) + if (!device && isolate_lru_page(page) < 0) goto put; if (!mem_cgroup_move_account(page, false, mc.from, mc.to)) { diff --git a/mm/migrate.c b/mm/migrate.c index ef68a1aff35c..eaae39564f86 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2135,7 +2135,7 @@ static int add_page_for_migration(struct mm_struct *mm, unsigned long addr, head = compound_head(page); err = isolate_lru_page(head); - if (err) + if (err < 0) goto out_putpage; err = 1; @@ -2541,7 +2541,7 @@ static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page) return 0; } - if (isolate_lru_page(page)) + if (isolate_lru_page(page) < 0) return 0; mod_node_page_state(page_pgdat(page), NR_ISOLATED_ANON + page_is_file_lru(page), diff --git a/mm/migrate_device.c b/mm/migrate_device.c index 6c3740318a98..1ab56b5b7914 100644 --- a/mm/migrate_device.c +++ b/mm/migrate_device.c @@ -388,7 +388,7 @@ static unsigned long migrate_device_unmap(unsigned long *src_pfns, allow_drain = false; } - if (isolate_lru_page(page)) { + if (isolate_lru_page(page) < 0) { src_pfns[i] &= ~MIGRATE_PFN_MIGRATE; restore++; continue; From patchwork Tue Feb 14 03:18:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13139322 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 7DBE5C64ED8 for ; Tue, 14 Feb 2023 03:18:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CAA42280002; Mon, 13 Feb 2023 22:18:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C32D76B0075; Mon, 13 Feb 2023 22:18:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A8585280002; Mon, 13 Feb 2023 22:18:35 -0500 (EST) 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 9342E6B0074 for ; Mon, 13 Feb 2023 22:18:35 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 5BECF80897 for ; Tue, 14 Feb 2023 03:18:35 +0000 (UTC) X-FDA: 80464439790.10.E1AD327 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) by imf29.hostedemail.com (Postfix) with ESMTP id 50F9512000A for ; Tue, 14 Feb 2023 03:18:32 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.99 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676344713; 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=IZQcyJjFlkQ044twydhzOb1ViDGQSIC6qjIfQyHiSiA=; b=WWtwHb/NP0AG9RwQ8m/4M1d1542MaJrlZa91JnhNG5Kq+pdqUdpX6ZYTik/16gitmF94Lt eJ3yOWUuJ0rdSp76seSREWZnNGF1WAd5+y/nSMZpgfNoqQy2ji8fOmPW4BcBhgyWq7JsX5 4ysYfytnxlY6bwX59S5ZXEMevRDuqMw= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.99 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676344713; a=rsa-sha256; cv=none; b=0sqif5PPjybowTYF6MMmhX5vbKeoyYp9uZ0EMdlK5+xm7amfbEAxvXFcx7Tw+Fcb6e+eZp mvdfaUkjMZMIL/y3nnP3C5JB4Sx9Qd+CcXYyu7nG8eFJGcsgjp2uAQCQunfM0XnJT0LSyW 3wXvL2e62FhjjDuydA3JXi0jPHzhN8Q= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0VbdtbCo_1676344708; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VbdtbCo_1676344708) by smtp.aliyun-inc.com; Tue, 14 Feb 2023 11:18:28 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: torvalds@linux-foundation.org, sj@kernel.org, hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev, shakeelb@google.com, muchun.song@linux.dev, baolin.wang@linux.alibaba.com, damon@lists.linux.dev, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] mm: mempolicy: check negative error of isolate_hugetlb() when failed to isolate a hugetlb Date: Tue, 14 Feb 2023 11:18:08 +0800 Message-Id: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: 4hf7ztobd8o3rk51psy4aybkecagzq5w X-Rspamd-Queue-Id: 50F9512000A X-HE-Tag: 1676344712-100456 X-HE-Meta: U2FsdGVkX1+13bumji834uWXiMZM5wrCvWCJMXJlzXEFqn2mUM3Za9e/OeSh7G2dp4FrcDzZD3vwInXde1/evBx0OoHjtprwnQWr5aKe1a0JKc4UN2Ah0ykALkwQPoOx/vwF5e3/JXh0JGqjz7Y26qyfJ4APzXptm03ia61L7IjsBbWn7ukGcbkbRU+ed5RcBmpJL50b+9CHSzl2Ezji7d6rept8iGcWdrvRAA4cxcgRD4UIrNKike4j2j88gjcxdXJiBS2rKSi8jzUYgGo8UennhNYzq+oc6ADjindSnlPOExhtsgtzbJb1FjdQDJ4nW8oY3oBfOR9chvAO2GwhBSn/pURZ9Qy7rHXuz6/XU22QL3Rh9RMV0D+NQkw/ShPQBie9nSYLeJz+L5IwLLCgxrFVTKmkadqEBZt5PrrsdVOZ2+eyTO/P0oomkXWOzAmrwx8C5hIQow0sZNAdCQ04cpg6Emn9eyKmP2M5HrkmEqahDspuup0VfXo0YNVeg0mUnrx07LUbMB6Mwskdu4QlvbNZkOrvk8j6eeuOFUvnkWPI+B8BQaqEtk3YQUU3yfO5DAK7QxJ+17aV13Sk+znAiw8K/2MXfh/DXz+01WkAKzkLyTAJTmbK/cUlgmDYu4I7fD95VxKDmjYODK3RIhdOhmTQ1ucArh+Ry3fjtUmuXLM52BgnUTop9/eAuWowPoYFpxYCkinqAiVoQ2IOAxZ8X5xSR1Qkt5MI6PMhFfHZ2LxgiSAq0KcDlgH182qjTW1mdqJBT/z8dwT/RZauC0EIrijacEOT4nTtFJuyAQmcUgr1v6U1rVkesDkVRDGD3cBlDv/aC+mppC0a0cg/HD0FBUuvsHS6QKjED6RGRy4GXkBY6EIzqFWJb0jYRp2NHFLuw+XcThCaYhu/3zyo6N9/RnJZCA8YqC8O5tUyOukgYejZQ9tTcmQQpn9o/L4xdErmkoNl0DJRMOMIa88btUN OXDwcu3W nuroDZy/omsPhjfzsCULQxYYr3z7v8B23uX7yXRcfTMAHcF/9hyXFJUnNrqBSSafyqro8jiC96PYtjkagV0szHQzP0P4OuhUMtEsIvltqY9O1DjuuIOzxdFg7rKB6Za46GCC6AKYJehgKZZ5EFvE0+5s1+wKPemAn5emG 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: Better to check the negative error of isolate_hugetlb() when failed to isolate a hugetlb page, which makes the code more clear. No functional changes. Signed-off-by: Baolin Wang --- mm/mempolicy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 0919c7a719d4..e3d87b21516b 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -609,7 +609,7 @@ static int queue_folios_hugetlb(pte_t *pte, unsigned long hmask, if (flags & (MPOL_MF_MOVE_ALL) || (flags & MPOL_MF_MOVE && folio_estimated_sharers(folio) == 1 && !hugetlb_pmd_shared(pte))) { - if (isolate_hugetlb(folio, qp->pagelist) && + if (isolate_hugetlb(folio, qp->pagelist) < 0 && (flags & MPOL_MF_STRICT)) /* * Failed to isolate folio but allow migrating pages