Message ID | cover.1676342827.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 s9csp2733312wrn; Mon, 13 Feb 2023 19:24:13 -0800 (PST) X-Google-Smtp-Source: AK7set/451+cJczjgLysyB+uauHSmcbv9ClGzBxwXquf6i76/f3mq5/x4I1b/awbrCWyNNwDzP1b X-Received: by 2002:a05:6a20:430c:b0:b6:40ae:823e with SMTP id h12-20020a056a20430c00b000b640ae823emr956140pzk.5.1676345053343; Mon, 13 Feb 2023 19:24:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676345053; cv=none; d=google.com; s=arc-20160816; b=l48cPv31zW3C+uInKAeOtV0NHNvmGQ6dHyj80ENUGfeFFpOWQOCjcXy7l631K/VQWS aGShMH0P4NBsjNm9zalfE7JvwzQvcjsRLk31xeBVBbvLamN22U45vD58mkxyHD9xZtQv 7uUH/XHETMkwn3UkcZ/Tzg3820uAQUmoeRZb38xrzZHVY+d2498pdVP8D+sNgu/LPBAa izggtDOkg4fK0v7SLvvqgPEjkGbOcsFT4sWTnAXH+S43aopVsHMIZykcbfQk95FBfNmD lftu2k5MIRLA5CxTUB+CAkI5Zd20/YBuVkA8gGNirODje8brn1vX3yH+pAVrWrd4BuV0 tvzA== 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=QimAzLY5kSup6/981xc0+DSkuZuDXRm77c7CFQArEqk=; b=bxM7ncq+wzNidTRBH1k5RO+0CNP5CkruvtF0kCcQkxVY3UJU6OVqSBYD9R8DG+8QqK H2KZYf4xd5dhX8rPqKm0twgHWcJ67zFBmUiydX2Azuh7PXQEjXS3AejcHLSlfJSSvF0v UX8AiNmQaitGOM99FX4DZTkDzrL/q00VWdcho8LjCzgi5nGsZGU7H87EtRL24kpKHhfH JgbaGo3nitqKEyBNLKe4C1qfzFqAIc5/HsLuXtxPsjH1OyU4MlOn1SmsqjcfixUW7cDf gYYXQq1HFZJ7FZiTglsKRhT88gkvreSKXmYOgU4KfWDdtIVsLpw4FmGew6H03TuKvJ5z R9pw== 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 4-20020a621704000000b005a8bcdced0fsi4271222pfx.222.2023.02.13.19.23.58; Mon, 13 Feb 2023 19:24:13 -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 S231344AbjBNDSc (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Mon, 13 Feb 2023 22:18:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229958AbjBNDSa (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 13 Feb 2023 22:18:30 -0500 Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0C1A4694; Mon, 13 Feb 2023 19:18:28 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;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_---0Vbe-fxI_1676344705; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0Vbe-fxI_1676344705) by smtp.aliyun-inc.com; Tue, 14 Feb 2023 11:18:26 +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, baolin.wang@linux.alibaba.com, damon@lists.linux.dev, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/3] Some cleanups for page isolation Date: Tue, 14 Feb 2023 11:18:05 +0800 Message-Id: <cover.1676342827.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_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?1757775190524034504?= X-GMAIL-MSGID: =?utf-8?q?1757775190524034504?= |
Series |
Some cleanups for page isolation
|
|
Message
Baolin Wang
Feb. 14, 2023, 3:18 a.m. UTC
Hi, 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 it's better to check the negative error explicitly for isolation to make the code more clear per Linus's suggestion in [1]. No functional changes intended in this patch series. [1] https://lore.kernel.org/all/CAHk-=wiBrY+O-4=2mrbVyxR+hOqfdJ=Do6xoucfJ9_5az01L4Q@mail.gmail.com/ Baolin Wang (3): mm: check negative error of folio_isolate_lru() when failed to isolate a folio mm: check negative error of isolate_lru_page() when failed to isolate a page mm: mempolicy: check negative error of isolate_hugetlb() when failed to isolate a hugetlb mm/damon/paddr.c | 2 +- mm/gup.c | 2 +- mm/khugepaged.c | 4 ++-- mm/memcontrol.c | 2 +- mm/mempolicy.c | 2 +- mm/migrate.c | 4 ++-- mm/migrate_device.c | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-)
Comments
On Tue, Feb 14, 2023 at 11:18:05AM +0800, Baolin Wang wrote: > 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 it's better to check the negative error explicitly > for isolation to make the code more clear per Linus's suggestion in [1]. Only one caller of isolate_lru_page() or folio_isolate_lru() actually uses the errno. And the errno can only be 0 or -EBUSY. It'd be better to change the three functions to return bool and fix add_page_for_migration() to set the errno to -EBUSY itself.
On 2/14/2023 12:50 PM, Matthew Wilcox wrote: > On Tue, Feb 14, 2023 at 11:18:05AM +0800, Baolin Wang wrote: >> 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 it's better to check the negative error explicitly >> for isolation to make the code more clear per Linus's suggestion in [1]. > > Only one caller of isolate_lru_page() or folio_isolate_lru() actually > uses the errno. And the errno can only be 0 or -EBUSY. It'd be > better to change the three functions to return bool and fix > add_page_for_migration() to set the errno to -EBUSY itself. Sounds reasonable to me, and I can change them to return bool in next version. Thanks.