Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp5382575rwb; Wed, 17 Aug 2022 16:56:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR6YNH/LuMvZz3aXO5WTHjtj5bqikN45RWIvIA6Ka6krDwLWAvtMnUT+9shj0pZ7TZxgXNjA X-Received: by 2002:a17:907:dab:b0:731:58aa:77c9 with SMTP id go43-20020a1709070dab00b0073158aa77c9mr237904ejc.743.1660780585996; Wed, 17 Aug 2022 16:56:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1660780585; cv=pass; d=google.com; s=arc-20160816; b=C4Z3ZO7dI5KoJQsxgdaR4C7GnET8XU26MGI93q9i6sifxQ9Vv9J4nRtcuFTpralzK6 vDXSefDPvZLBD9JxGSi3mLmk/GO7ZrJ1KH2CCdNw6PikwEKqCYUJqijoigS9akdUDZeD rFn2VMu9DT5tljXrK0e4sasR0nWhJjET16YNI0uKkxNkl7lacTwr1XxtMTyUULowOXmX 9rg+QBy4BUYJC21isOcs0sbhgRWARO3H1Wi4+47E/tuA5liGVwDnRqqDlya2jeiEC9kQ Cn0SCfmKUOzbSvMetzm6RCB7jsOVdtzUCW0yzjtQxcrdYfzBIIGkFKt8xAGqOKihnYqD D/oQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mCftBy5KoxlpHiTJOh64PY+ZlVPYUckWAcPQycZ3veI=; b=qlACouYvTbHl1MmSJzNYLBwj8Dk5McRMrw3KfF22kCtK/ecqN4io0WA9GPZkLd6I5C 2mh4jKLWN39c+lcG86m6PbjP5u7sFRhZym0UvdOXvtF6XZLxK3uIamcwQozE+Ax+RFwK BokeI0JiBvkX5hf4zWyGklPGwnr6eidEhLKWKQsignhGGvw4sz21WBW/Ebe1Gh1sAyYb eSFHqEoJWYrio3KSkyRLuhNuLsflD1S/dDHdWMTOfUrgAl158QBLu/v437m3YCJzVLpn yINDKyGoQxqH3ZM1Rdmlb/KqsfJX8/b3b+CKmRQEN7VcUFfu/b6nBwhnxWHHhCk9sWDy HV+Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=SvDvgkOG; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.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=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji15-20020a170907980f00b0072fb44407fdsi14489985ejc.962.2022.08.17.16.55.38; Wed, 17 Aug 2022 16:56:25 -0700 (PDT) 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; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=SvDvgkOG; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.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=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242459AbiHQXkv (ORCPT + 99 others); Wed, 17 Aug 2022 19:40:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242337AbiHQXkt (ORCPT ); Wed, 17 Aug 2022 19:40:49 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2071.outbound.protection.outlook.com [40.107.92.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F7647E80A for ; Wed, 17 Aug 2022 16:40:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JrfPOEVb/QpMmYob4KLfN9WBhdZRDk+DfjcEEE9uSKQOztYzpJXtJEB2YfTZl1b+WH4STNlNdegbEh/aFA5Nl9bEGHsd6vLTCa53bH4J14H+wgU+3ocJF9anX00L9jAdClWPWNDovrpJD6bSCsKPn3WJJh83YSzCYG3kReCB36eNOT5dPqrqiZvawMTNY3dMHN4bVlqyaFd+vMorTLHLzaNwB20GIITw9aGgo6dOJ2Xl5DMxFYqEaI+JHdufTmtZ48RumChDtWm6+G2wPORx3OdPE9ho+QrXPt92d5tAyqwZeProwJTFySyUgd9EMCDIjzm/oR60Hz9eYavvVQ7IDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mCftBy5KoxlpHiTJOh64PY+ZlVPYUckWAcPQycZ3veI=; b=oO/aRdJEqJXEd0N18V57vDj/W+dIlAixLcPisXKOqL62VqVERC5FHFNoUX60wzz0/jHWa+jCUqKNn/ULmAhjhZfvJsaSrfVcMC3oOHyC4I6dNqS6LjWOavNH/sp8J71lrYOXXggSjLjEVwqPaxz5tF/iN68ktzMJFHwGIfj6ZBCIn1+diHDUwkByddMg22G7f6jxYrVh/vbN/IH5B7UEfCZBnw8E2+F8/8XzeDMzrUDYkzWwBdCIAOr6OzxOQl3ujw5pLYOA0EZuvL9irRE0a/bvZUaZQy8zeL2Q1ISl8lmrYp71FqOkcU02yilUSnGKA2X6IqTbgnioWnUNgGzaZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mCftBy5KoxlpHiTJOh64PY+ZlVPYUckWAcPQycZ3veI=; b=SvDvgkOGFFrTTGwr2C7axaf45smJvpDrreAP9LyR7iSYku6rnaMTCadx49zqq344wW/XXUN2zgOd1tHGKvy3OGnleaRAMTt2xoVoNPzP4qBwHUBNlW4VspiyIi0lTmKa1FPWyeYAken+UsmYcGjKEwpBqStdlObbOEVidtnw4qjjaqdjLYoaIx4YduTr9XnS/B9GXOrhKt7FX6UX0QzEkyHDxL2UWQOjM5DjgJT8uutDbhQixt1LcHNU3FdA+HWocAngX69fo8IUax2fclZ/2F2BoxfGHEl/7URNXZ5aCa+/KsbN1xb/nq301j5El6bhQPIalMHhBrImoOBVNZ3v3Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB4192.namprd12.prod.outlook.com (2603:10b6:208:1d5::15) by DM6PR12MB4121.namprd12.prod.outlook.com (2603:10b6:5:220::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.11; Wed, 17 Aug 2022 23:40:47 +0000 Received: from MN2PR12MB4192.namprd12.prod.outlook.com ([fe80::462:7fe:f04f:d0d5]) by MN2PR12MB4192.namprd12.prod.outlook.com ([fe80::462:7fe:f04f:d0d5%6]) with mapi id 15.20.5525.019; Wed, 17 Aug 2022 23:40:47 +0000 Date: Wed, 17 Aug 2022 20:40:40 -0300 From: Jason Gunthorpe To: Alistair Popple Cc: John Hubbard , linux-mm@kvack.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, "Sierra Guiza, Alejandro (Alex)" , Chaitanya Kulkarni , Dan Williams , Felix Kuehling , Logan Gunthorpe , Miaohe Lin , Muchun Song , Ralph Campbell , David Hildenbrand , Matthew Wilcox Subject: Re: [PATCH v4 2/2] mm/gup.c: Refactor check_and_migrate_movable_pages() Message-ID: References: <487960bf67c7273ff5606c76f73bb51271bc7b90.1660269441.git-series.apopple@nvidia.com> <6b61e9bf7c65f78524db32ba3e65a7eb6b8a76a0.1660269441.git-series.apopple@nvidia.com> <87edxgvixy.fsf@nvdebian.thelocal> <87wnb7tycb.fsf@nvdebian.thelocal> <87k076tpd1.fsf@nvdebian.thelocal> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k076tpd1.fsf@nvdebian.thelocal> X-ClientProxiedBy: BL1PR13CA0009.namprd13.prod.outlook.com (2603:10b6:208:256::14) To MN2PR12MB4192.namprd12.prod.outlook.com (2603:10b6:208:1d5::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 606cd5ae-9dcd-42f9-7ab8-08da80a9e8bd X-MS-TrafficTypeDiagnostic: DM6PR12MB4121:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0WAyg83xrFC5+1f7vjVWQKSHNxT81NmXq5BY0FsFgWIWRFL6nXLlYYV3RYl+LU2nD7Ho+K2Y0OcZzW7sPQMh953VFG6XIuD0UoJvmw5Ls8X4wHZcRtla5CT3tZEPgVkqLnBAoWLJOLeySY48PowDwBZAOqO/PbSlHWTq4YX99dHiy9yuo5b/d/tXE1vAVrgHBnCQA+qY8WnmD6wt8IJP/Ab/BG1ngzWc+6zBU0zIz1mX9SLpBX35NBREDSh572IpRuvzyFdZk6+tYMHvwKBzF05eUtUBF+GcMBqHKcMWzVVdPRiOod4kr6Q0aQAV3FfXBuuCQWBkZCUCum0GG1HeQ6gWCVAxVkYr8BHjybwNa4D4O/C3hfD1Zepae2KdvVgvMjqy/k3nSBKhj65uBop4Li6ld+JZt+isWIw2/MH9/qlLimcEUJXiQQNyGNj+1NemWWuSnsr0D82yHR+XEY5zD2+nAa1rAWhTExXt+w6eU7r/b5oPsnxcVG8K/4kgoIGSPlL5KpEDfRxIBMvtrC+CN5tt0FIf6V2VDBnYDtzKans88A+qaAaiqhZu8cfdDVrTo4j+NEkLOnlBMYcbeMw8J5Ph7SQpdT4T5+3o2xp5STuFx8iHlpSsKEjGmIf23uCkEl/b17z5+x/QhKmP8gUnqxrg1KSkdbPo02CfW3THi6jhYyNhuEHB32zURGscuWShjaYM12VB6bR0jjqUfi6OlQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB4192.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(136003)(346002)(366004)(396003)(376002)(38100700002)(4326008)(6486002)(2906002)(86362001)(8936002)(6862004)(5660300002)(66476007)(4744005)(66556008)(7416002)(83380400001)(37006003)(54906003)(6636002)(8676002)(66946007)(6506007)(36756003)(186003)(2616005)(41300700001)(6666004)(316002)(478600001)(26005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?SXFZArKWqo8qrSBWfWK0wieO9PsBpwz53E4SAVk0wKoCudbwO4Y/gC2eX8Os?= =?us-ascii?Q?/1ATaYEQoJKaU5PdiNWPTgGdL1uguVsyHJFQQKUu25kLBahIjN4yp8Ao0mJZ?= =?us-ascii?Q?djqkN7uTVrBnwk/icyK2LR7F5HxfY3DILAYvBLmCfwEfF/qf14TB5A2pakgc?= =?us-ascii?Q?pw/t38xOjnYBGvRXF7sBY89ACXMybFO+DEa/zJn+AdvnPVoWlsCTgHwNhaah?= =?us-ascii?Q?DMfSdZ0k0xy35+MC52BppQZbhO7wmCTp0ToBhjgaGryHh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/LDHSMD/N4/TeMlQJDi5ne1N1T8DcNBAFQzGm3V/h/wJ/feGWNV?= =?us-ascii?Q?pkU9kuwXQGImOM540U8kMwNRD4Yf6A+KhFqPuChoashp6ueFascgUXpK6O6y?= =?us-ascii?Q?QlxVhYIDkHvOPZC5NILVfK+1jRLvogJd83dz5ogt8hO2mZWcN8HRfSj3FC2/?= =?us-ascii?Q?qJV2UhDxrMwY///np6y550Yv2oQ5ilGCU3ioboBE6sLSSaH+3TKBfvY+2yyt?= =?us-ascii?Q?wfbYIVatuLpXV3qRLnKOc8QoKpqwlu73qbK4WFLvsje4Z0StpOczDIk+3Qp6?= =?us-ascii?Q?SKD47S/LKrME7W1YXD0VROmU7WRuov5TL6Zuv3MwdFsSdoDVsV3aHSzfSyAx?= =?us-ascii?Q?1R77bD929AuhX9/RPJ4mfEmQOnxTDWkc2VnDg0aWa4QIHDnHDwRU9qdF5CoK?= =?us-ascii?Q?A+IdANrOtrzCTcb5Hu0dBbG6OuCD1t1Zf11NFdyY?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 606cd5ae-9dcd-42f9-7ab8-08da80a9e8bd X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4192.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2022 23:40:47.0000 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vYdMwXiS5n6wt/zVGKeQuMZTXdQacjjaFMtH6P4R8ZEOc8D0Vq8c4hT7ail4S8uj X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4121 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 18, 2022 at 09:24:28AM +1000, Alistair Popple wrote: > collected = collect_longterm_unpinnable_pages(&movable_page_list, > nr_pages, pages); > if (collected == 0) > return 0; > > ret = migrate_longterm_unpinnable_pages(&movable_page_list, nr_pages, > pages); > if (ret) > return ret; > > return -EAGAIN; > > Which IMHO looks at lot more normal and sane than what I had. That isn't "success oriented flow" :) > > But why return 0 from the helper function in the first place? > > To stick with the paradigm of 0 == success. Ie. But it doesn't mean success if we squashed it to EAGAIN here. -EAGAIN == retry 0 == success, real success everything else == -ERRNO, failure Stick with one convection in all the functions in this file in this grouping. Jason