From patchwork Wed Feb 15 10:39:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13141506 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 9294EC636D4 for ; Wed, 15 Feb 2023 10:39:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 17F676B0072; Wed, 15 Feb 2023 05:39:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 130756B0073; Wed, 15 Feb 2023 05:39:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01E5F6B0074; Wed, 15 Feb 2023 05:39:52 -0500 (EST) 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 E637F6B0072 for ; Wed, 15 Feb 2023 05:39:52 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id ABC49121441 for ; Wed, 15 Feb 2023 10:39:52 +0000 (UTC) X-FDA: 80469180624.20.C8277D3 Received: from out30-97.freemail.mail.aliyun.com (out30-97.freemail.mail.aliyun.com [115.124.30.97]) by imf06.hostedemail.com (Postfix) with ESMTP id 53FCB18000B for ; Wed, 15 Feb 2023 10:39:48 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf06.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.97 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=1676457591; 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; bh=FB+0sNcKLWtcXA4GLd/mA1/srU+jJRulqlkMJrpH60w=; b=EOhdSFTWizu6eOufSr7Ooi5Yu/20LW+UlbB52ApR3mdgAr5w3rICc3UJjsUTxkFx7zcLCX 3cAMjvf1A8Gfedhw4SMzJ4x3Z474yV2tHjWW9trUX2uznV9r9aPoFNS8CBLUNSFDYEtztS XPjBQvkXq2MG2UkL+YuhnrCzGwQzMuo= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf06.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.97 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676457591; a=rsa-sha256; cv=none; b=pexJ1s9IL2sOcljgXrFhbWqTpkUU8/phJ0SyfL1M6BLIKW73iYCC/GPkcVw4YDMVeCt+q/ DKxtqgw6+8id62ktEuTRlnfq1TeYomBiZCqDYo9ZH6ucAnTwGJ/MBEO5xoREPb1oMLqnn1 ykiausEchxAlcPzhfgOAOFzenNeD/jE= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R921e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=19;SR=0;TI=SMTPD_---0VbkDfVz_1676457584; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VbkDfVz_1676457584) by smtp.aliyun-inc.com; Wed, 15 Feb 2023 18:39:44 +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, naoya.horiguchi@nec.com, linmiaohe@huawei.com, david@redhat.com, osalvador@suse.de, mike.kravetz@oracle.com, willy@infradead.org, baolin.wang@linux.alibaba.com, damon@lists.linux.dev, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 0/4] Change the return value for page isolation functions Date: Wed, 15 Feb 2023 18:39:33 +0800 Message-Id: X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 53FCB18000B X-Stat-Signature: d5ng6xh7c7rrdouszewpda7tcheo1ita X-Rspam-User: X-HE-Tag: 1676457588-688459 X-HE-Meta: U2FsdGVkX18OUZwb1pLl2Tmf5iDp6j9xdtAikOMBm3o2zl2lSBFICtsMUStrYYJI/ZsvIErW+HHlzNbh5zNGexK5jX7gA8X7U/MKjPudKP3QqxFG8oNXH71u08tqkCWsyfhgj9r/VsN2EIA4xDl+5hL9DoEk0fJtIX5qjaLoYD4PT/zuM1J/4Hh9N03Ofs+72M3f4vlBRTHPqgDQS1ec6KJpPOTSYSfmvBmpMlBhWBTatcMPoq/SfeB1tRX1ol9QlTpfPbQ9CcpTaae2oO9H6I1/g8feLoczkZsci4CLF9Q8m1wKGVsEE+isquu+O8ibi8clPFhq7Afe9S7MY1HlRQpEGjhipncMcus5uuz/wHaj3xiM9BpmP/W6lz/A4t3FdgK3imUI5JHAKAKNW9Pqssqfi7i9NaXzsCB+PUex0Htjd7Ki+fyVpF46VK4DKbu1FWeTXedKzS+ObLNORYERmCdq7T+kWcdt1I6rVfCl/1WvRB0xJBLYVHf64K9nrGR0QPPB2TCyz1NDASEgHgMBu5DmXIcPW6TeRdfjH4ytUNnGLOAW3HeZ3GwQeU2wY6wmGaYCzYDb3V/ECOg1vBGLQTuw5L1ZajJKhltnf0sQmMOTNVqEm6AhCne67i2MjCKzJXI009OJ8nU2PdNvoYLvnH+yzfxihPc+y0+0DARdZ3mzRR+0Ns+XeIo97wSbtxOPQyimsrKOx/oo0xF+Sbm9engC9zZmJ6SnrgBbyZNom1CmZ2kG84s3V9DXY+ESvVVkiO1CnM5hpYojwso224Y4rM/oVQPnEXlHmdSutyC3l34jOr1m3lHHVMCn7f/jIc42b82QNGw6Sz+ZarrKsKuocw2/kaxdmWqso3ClzmUd995gn2wtOcMPZC0XJpsf3Iq88gifAz4emI0IUubz5oGDbKuFd9JiRYCtwGoMKOLuaeGitQyZfw05D/7FgD0jQjhPtFFlhaAoQAnRxRtM/7p iJYc9AHP 7fKYRnB6GgARJIvgxZfaLExxucM/MROCpz0xkKTVz4WDGMR9MpQ//Gk2BphWL0GoN8WOdMJU0ss0vFcCN3CSvEUp65g== 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: Now the page isolation functions did not return a boolean to indicate success or not, instead it will return a negative error when failed to isolate a page. So below code used in most places seem a boolean success/failure thing, which can confuse people whether the isolation is successful. if (folio_isolate_lru(folio)) continue; Moreover the page isolation functions only return 0 or -EBUSY, and most users did not care about the negative error except for few users, thus we can convert all page isolation functions to return a boolean value, which can remove the confusion to make code more clear. No functional changes intended in this patch series. Changes from v2: - Add a new boolean 'isolated' variable for functions that require the negative error value. - Keep the same return value logic in do_migrate_range(), that means it will return -EBUSY if all pages are failed to be isolated. - Collect Acked-by and Reviewed-by tags. Thanks David and SeongJae. Changes from v1: - Convert all isolation functions to return bool. Baolin Wang (4): mm: change to return bool for folio_isolate_lru() mm: change to return bool for isolate_lru_page() mm: hugetlb: change to return bool for isolate_hugetlb() mm: change to return bool for isolate_movable_page() include/linux/hugetlb.h | 6 +++--- include/linux/migrate.h | 6 +++--- mm/compaction.c | 2 +- mm/damon/paddr.c | 2 +- mm/folio-compat.c | 4 ++-- mm/gup.c | 2 +- mm/hugetlb.c | 13 ++++++++----- mm/internal.h | 4 ++-- mm/khugepaged.c | 4 ++-- mm/madvise.c | 4 ++-- mm/memcontrol.c | 4 ++-- mm/memory-failure.c | 10 +++++----- mm/memory_hotplug.c | 8 +++++--- mm/mempolicy.c | 4 ++-- mm/migrate.c | 20 +++++++++++--------- mm/migrate_device.c | 2 +- mm/vmscan.c | 10 +++++----- 17 files changed, 56 insertions(+), 49 deletions(-) Reviewed-by: SeongJae Park