Message ID | cover.1676424378.git.baolin.wang@linux.alibaba.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp117602wrn; Wed, 15 Feb 2023 02:45:18 -0800 (PST) X-Google-Smtp-Source: AK7set/+bUN6vKsZUBEK93NfNlMJuM/wabOcHma9lFhTpZaYTGcZbhA4bkUp9gLuoafNCiTfVYxY X-Received: by 2002:a17:906:a84a:b0:8b1:2c2d:4658 with SMTP id dx10-20020a170906a84a00b008b12c2d4658mr1589573ejb.33.1676457918430; Wed, 15 Feb 2023 02:45:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676457918; cv=none; d=google.com; s=arc-20160816; b=mzvxEHzfYgqvxmuC1K5xwZHScLfEXTBodNmFj91dk2V9Ql6AsMATPNdknxyyMpJTzZ iSh7kH6KPef94F8sk2w5ulL2FJkQqhje8EuY4CHxHxWJGyKzXUpDtzpjsb0ldv8cAPKR 3HV5biXufcN1dfBKL/x2r5pF41u/F6z8L0PEsgMSPdZXRcqLX0lI1FBDGO4zmgs+S+Zm KCKEbuKcsTZh7d8OSbQkXoyXCn518f1k235Ad8UlQBayCMDlrk2jilGbhELGTLhM7uD1 3W7a/88emD06bbjKMvn8ydrunH2pIhdeqv7jFOj5SsDLIZ3QgYs+oEvMNpAq4ybPnR+L Ht7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=FB+0sNcKLWtcXA4GLd/mA1/srU+jJRulqlkMJrpH60w=; b=NnV+GChzs2P7qbYTlyetHvMcHYqtzP+NSl8+n/kuouPg4BLaolinmNkmwBkHDRZRNk +D0h0uDHxMLhKkvckGQYUoQluBbN0Tx1IbsrZ4cAb/8qhzFFd5mF2KNqS50y0qEw2Mm7 wKgDRZlAhvZrrouk8kAOldi8SmnpgnS3M7Sf9yvigDyUwyfz4+3Y98VzoEJ7GNx40QXF 1ln5Dnd58q9tzgyU1p/jYg7/+vC2KTeeLkYMZobNQJaMhFqDLL4C7yauWIvlk+O/yAVa M9rqlzTFh1uozgqjXQDMlWgieeOj4XD1V08o5WISVWyhnr/7p68kFfzddGZeKlLrRvq7 Tvpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id az22-20020a170907905600b008b13beeac0fsi2626564ejc.506.2023.02.15.02.44.54; Wed, 15 Feb 2023 02:45:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234109AbjBOKj7 (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Wed, 15 Feb 2023 05:39:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234099AbjBOKju (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 15 Feb 2023 05:39:50 -0500 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF2E9360B3; Wed, 15 Feb 2023 02:39:48 -0800 (PST) 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 <baolin.wang@linux.alibaba.com> 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: <cover.1676424378.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757815622690519107?= X-GMAIL-MSGID: =?utf-8?q?1757893537985852662?= |
Series |
Change the return value for page isolation functions
|
|
Message
Baolin Wang
Feb. 15, 2023, 10:39 a.m. UTC
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(-)
Comments
This v3 series looks like it's making things more readable, so ack as far as I'm concerned. But it looks like it's firmly in the "Andrew's mm tree" category, so I'll leave it up to him to decide. Linus
Hi Baolin, On Wed, 15 Feb 2023 18:39:33 +0800 Baolin Wang <baolin.wang@linux.alibaba.com> wrote: > 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. For the series, Reviewed-by: SeongJae Park <sj@kernel.org> Thanks, SJ [...]