Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2503391imn; Tue, 2 Aug 2022 05:32:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR7YS4Dr+B2FS1xbp5WCe2SBISv8VoVCAtkC7HvQXbpx1b7tcgHJpedE3NYmbFmdAvNuShCt X-Received: by 2002:a17:907:2d8a:b0:730:6880:c396 with SMTP id gt10-20020a1709072d8a00b007306880c396mr9134641ejc.192.1659443541096; Tue, 02 Aug 2022 05:32:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1659443541; cv=pass; d=google.com; s=arc-20160816; b=TY1HBcA8atLSpHFkUUbmOC1f1rAe911wdpKNH3DI2VnNuVTG6SaxsYrUSjnKQukKQI BAxYnbD1AKraUq4fXqNG4yZeuq8s91K1r270cocAPHXTn+nUhKjRDmwRi0Xc09ZQya/8 me1Fik2L0CYCnCAAGl739In9XMez/hmMnLK0l6ns4Ul7jJ5Njr87UZVZgfUkhr8i1Qky iSCTBsZFu+SN3G16GGBGL8QHQQZsFSO2IWUhTionoDvod/ht+WShdVXhZ4Vx0vu9X/1y rrDbUngG9V5OwOTIKUNawIU3yDDTTjPFF2Mu7K9T83aTNcvwfRMQQmFKjohyQI9tXkPg KYrA== 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=p8Wf7igpZ6BRS/f7j4wLh+6TR10YEMwoWG/kdfE/JsQ=; b=uRMPqii6nzxHm0MHDIFIQDq5Bm7X9pNfHV8nv1VmMDENmyx6o7qJKhkNbJS/Jhs9wB XX45zf6TW/UoiHYj3l5KThQcR45C4DBMejva7oHkIwDqzlYL6sns3rtKZlAX30Fr71hj 5TTGy+uZOgIJL4jNbWuV++A+xfCQuiAb8rMrNLH4WI6ZRWRyxeU0CFhIe/8tz4zDgHYU X8xr9wS8wT5OXFrp/zdPKyzp0LaoKOt8XvbnUz830yU69yzwLagfJqgtTXuGMDJUdW/F ScalgNPwOLJb1sJlxIef/W+vy5HazQTPTksPADb+3dzrHAivI62UNXFCyllouKl8dLL1 uyew== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=IToLk9zu; 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 b4-20020a170906150400b0072b3a874867si10463046ejd.874.2022.08.02.05.31.56; Tue, 02 Aug 2022 05:32:21 -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=IToLk9zu; 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 S237000AbiHBMVS (ORCPT + 99 others); Tue, 2 Aug 2022 08:21:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236738AbiHBMVN (ORCPT ); Tue, 2 Aug 2022 08:21:13 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2042.outbound.protection.outlook.com [40.107.94.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2171D286E1 for ; Tue, 2 Aug 2022 05:21:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cyeh+/Ffjf3lVhinLwBUoFSM39yQ6u+Fc8XQbQDC/ifQTN7CI3X8J6HY7YXT+J4Qqn79kcQSyu7m/zN4TX5PbS7BCYm4g8+VoiuiWdDC2OsrzN0WW0/YDaeSPTZrETU/wr9IApx2DHjqaRawtSv0UvF2liPvKrkRdi7hx0sWBZtPoeKBt77s7u9zTArVuiytz5dfTy4zopK60GgJn1YiMt36qjzqibf+wfmieu6KtWb2ShcX5C+bcZyTU4Y6QGT1Jc1rFtke+GQYJVWlVSTeQPaapAWr5fdNlsk/x2m6dHVJSFJhphnbzkqgCFQm7R0HnDT/Wzao2NROknMtQ8FyIw== 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=p8Wf7igpZ6BRS/f7j4wLh+6TR10YEMwoWG/kdfE/JsQ=; b=dySUHvGub/3cdlUZDs2samxEho4LSOOjuMdOoKm0wv1CmB5EwGPkifMRKsGWPsMhMQUqPup1ZsVW+hIDPwKn0+jsJ1loHw9rcr9uDQCQqmABglcfiofNtSnZlUPkGbjyBCd4hClgqoDA5cE/gkgIpcmzqI61X1JnrDyBVO7iNrhszlW7hsfgZLVWS5F+TtqaPsEkEFxAtJbz83t62zh9y3WzZzytBS4jyULBLPNoPhAA0a4XLcIltBn6kVVCHK19YmvwADazkzCGG4vfRufT+BxXo2i/RoKJyYAVWOukNAStiLDp6ZRpSW4qWmJq/R9y5ElF2ZqkP8x+3jL+R7oBqQ== 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=p8Wf7igpZ6BRS/f7j4wLh+6TR10YEMwoWG/kdfE/JsQ=; b=IToLk9zu1zI8dyamyYFrpA8gJYyyO0RAeA4BWErjAEUL8xzs+1eQfnZSDdnihhjKHz7PsF3bGS6ayK8GdhtO27hFF2B3SSYEa4OYrhyfA5eS7usBF90rCbpZDUdvIJLeTjc8D3e1AXKiimGns/6ja5nlgd6II0gcM8Lmp2Ygo80mWxQfUhlFge3DZLPKAgCB9KHTvXFch7faaxbL0UiI2ajnxJAtJw2F5KR5sBRJ0wZyGjVjy77v6JwzPc1zN7G0L5slHk5p9S3r0lFi3LqWUUj5uyMTbz4e9TP94W9xlve7PbhPvzCZ/7MiylF5xVifMwNFvXyzHjxcYyCvZ5IyFw== 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 BYAPR12MB2885.namprd12.prod.outlook.com (2603:10b6:a03:13d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.15; Tue, 2 Aug 2022 12:21:09 +0000 Received: from MN2PR12MB4192.namprd12.prod.outlook.com ([fe80::4cce:310f:93:5d58]) by MN2PR12MB4192.namprd12.prod.outlook.com ([fe80::4cce:310f:93:5d58%8]) with mapi id 15.20.5482.016; Tue, 2 Aug 2022 12:21:08 +0000 Date: Tue, 2 Aug 2022 09:21:08 -0300 From: Jason Gunthorpe To: Alistair Popple Cc: akpm@linux-foundation.org, minchan@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, jhubbard@nvidia.com, pasha.tatashin@soleen.com Subject: Re: [PATCH] mm/gup.c: Simplify and fix check_and_migrate_movable_pages() return codes Message-ID: References: <20220729024645.764366-1-apopple@nvidia.com> <87wnbsd6yp.fsf@nvdebian.thelocal> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87wnbsd6yp.fsf@nvdebian.thelocal> X-ClientProxiedBy: BLAPR03CA0039.namprd03.prod.outlook.com (2603:10b6:208:32d::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: dc983db9-e1a5-4759-d451-08da74817adf X-MS-TrafficTypeDiagnostic: BYAPR12MB2885:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +cx1X5sqd8bEQnGn/Yfvgni5a10TevlWLtM0ghkKO5lQk7ksUN6oKQ727FJJ8jMBmO6T57jjZdPupl9wYY3kVib30vmPZkjH+BJI2c5XXGoCNWcXZM2AAEJUwjd3jqzI6ai/m2xh7HIMpDMUKF2QyVPhCECkxq/Eye8YiL8UVfokiuPqS/fvbk9zBQ6btEmxdxEC0oC4pTw3tOJD+D6bhBqMHP8VoEggjRLSmrIWuyxoMCfP7yObivG73p5rFkv5i8dk2q8GXNCqTuDTKZNk6/V2PjHV8pDNhQMDnqSusNFpYzNOu99b+Q2a1xsz4w/csB4J2ChYxuwwuWrYRaO1vHWRxo8lCmoWjrfKxYfQViWdEzUJNWhIQc/j+w5TAU1dlEApCIzTOCAwEPHKDzDiJnvgQJsIUctdeO6/X36e6EcR3dKWujPx97+Csx/WusE9D24Iflv1an9NBS6cevSSRQKU55djErU5BbLPmrqnjKEV2bnvV/Fbcd8CcPahkLFe+tVJ4A73LUinDB/Bk4G4WBlUyidclEtf4W7gE+PEwgZgIOQn+W1bRT6USnc3auTk9xq6LUojfzdUH2JuRMWEN3Y54zLK2qG4yH7d+EKOvcFKe41UtlDjAVaaIrD7ZEj7Qwd9KtCNjGLulOjMhhaaGsayHEds0yWU3Wi+htN9kNfr2YQw3HRG1gYcgI1Kwjtu+4F7RGtcvJUIuwzZLo4C4vYR1b658hSO0nKBIOR+yO4= 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)(366004)(346002)(396003)(376002)(39860400002)(136003)(6506007)(26005)(6512007)(6486002)(186003)(41300700001)(36756003)(6636002)(37006003)(316002)(66556008)(66476007)(4326008)(8676002)(6862004)(8936002)(2906002)(86362001)(5660300002)(2616005)(478600001)(83380400001)(66946007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?aGJ8REsERv0+AmTduBPjswp50Z+UszLQBv0AyntSSGIhtpLaMZ7e8BMXRSyp?= =?us-ascii?Q?4P2gbdUmul2eV4F0QOXpuESxssworio31ycBWITaB8seIno0m7kiVT9Sil1t?= =?us-ascii?Q?ONvxoDbdwydxlSDKS6Mwgzwt7iyou3vgyQ19Oq+57lEmyhpDY6o9jc3nHvxf?= =?us-ascii?Q?hXXHIzLtZintU7tGe4nTkN4g4Gax/qRRmaLnfTQE+B5SI9p/aQldOWXb1COq?= =?us-ascii?Q?PfVAhGxzA5/TGD8j0df7mh0TmnLqetO11qTzr/eGXCNzxNaDmPbzrtwcI9x8?= =?us-ascii?Q?V9btUD/Hd4WE6NM1pH1YUpc6oxo/c0rEokMWrerT2GlWCDQkYQABObwJo/K1?= =?us-ascii?Q?gLSsDy4qo/UGBYWIhAQC6JhdvxeJ/0bBBrdcd3OgHXNHKhRcqkKxJuR9RVcN?= =?us-ascii?Q?D9+ALJBCYMKaAfP1EZEuef5nVKQSJ2MqmKoQ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qDWSy02BO4dyNBdtcoWa4ahY2j+nxWvrZekZE6XZCAupq1DR4sIwvxF?= =?us-ascii?Q?vbfEIIbUXxRDoUn/yBS3FlPxkNek/s9o1LETlJAysjHzC6ijm+oDzCuYnKFB?= =?us-ascii?Q?fuuLVHvbaTIYfi6YWFosQ4sfZBjVwODsPOx/uZlzW+5QzQPJaCchZemGx+TW?= =?us-ascii?Q?ArFb5tBp20TrgSwLjS5VT34CY2ixh35DymDO7oavX0YZqqBm0wD68Lz4UtZr?= =?us-ascii?Q?em/ThSlhI0gQFgMgy8Eb2wP+y8eZJOdHSw8aI2Bx?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc983db9-e1a5-4759-d451-08da74817adf X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4192.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2022 12:21:08.8844 (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: OWLZCn4Vu6LOiU8PkyNNyqXvoP9l673hknon/H3hAPW3aGvBN47TSwOsC/pJg7jR X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2885 X-Spam-Status: No, score=-1.7 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 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 Mon, Aug 01, 2022 at 12:18:53PM +1000, Alistair Popple wrote: > > AFAICT there is no reason to 'continue' in most of these paths since > > we intend to return to userspace with an error anyhow? Why try to > > isolate more pages? > > The main reason would be if callers want to retry the operation. AFAIK > isolate_folio_lru() can have transient failures, so if callers want to > retry it makes sense to isolate and migrate as many pages as possible > rather than one page at a time as subsequent retries may find different > pages that can't be isolated. Except we don't try to do the migrate, we just isolate and then unisolate and return failure. > Actually I should have called this out more clearly - the previous > behaviour on isolation failure was to retry indefinitely which is what > lead to looping in the kernel. This patch turns isolation failure into > an error and doesn't retry. I wonder though if we need to maintain a > retry count similar to what migrate_pages() does if there are unexpected > page refs? This makes more sense, exporting this mess to the caller and hoping they retry (they won't) doesn't make sense.. Jason