Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4717149pxf; Tue, 30 Mar 2021 15:26:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyY8x5ncJnMfSQngir+QoiZ1/3tLQ3ZnppHydQIZlpMhwxooFgbJ0qyVdR3Pi0Ix9xePabD X-Received: by 2002:a50:ec96:: with SMTP id e22mr23405edr.385.1617143190149; Tue, 30 Mar 2021 15:26:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1617143190; cv=pass; d=google.com; s=arc-20160816; b=Kr1LZCIaZpEa4IFai1IGuzupeLaLoiADhldKGO26JqHkYTpXUBDhisCONcME76/zxi HP+hstjL2aTBAlUoTc+yR+BPexg+1VW4B3sh/LJH6FveF4P4ONEUUxo3CRaM8bAk5Yz4 NvsBa8yCpBKuq5bJG6LcFi1d1lfoViPRyQ9TkUg7Z66HY6GgiKqb359HfltBMISueAgq TGdkGAH0QwfjCsNCQ/QKmVpwbd2RYZgtdOjYf2pjhCFZxU+xVaCjm6rilHX6T2CKR4Sk Yw/efFiZOdTdlUt4m54X7xp7FQx95/gS6B2Lc8P3Fp4Vs7lfuRZ9tvIIe9VdsEtzflw3 8F2A== 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=w9ukJXfq2a6VQdE00YdgAIqNmhLcocMcEz1uqfCRjW0=; b=iIoabQXiLIgVmgISvb8XrbaMk/BBs/DT9hFmE83RxYls7ZROGtm2Uxqx/RKToxnIdA YOLpd/UuDxmmyM0N0QWrjc7D9kPRtkaZudjN9i7P18B7qQ5X4oDKWnRas/Kgp0bxmkdm nsnHwk+M7W/KRf7yFJMIXqQDkQv+PRwXqhW6Bp223tWMvv1wXTMmXIcepOwB/hd0RsIJ Ui30T2LZlJFl194iEc+vjcx+jlKJEgtzc8Fcy/eDk06aZdwePNJamR4nldJ1fnX5bd8j VpB2LZ6YmFoggxPHlnXsLB7Hxkc7qaRv/2uZSQ3b/nUf2sSc27ClBr9YK1jyx3qZ2X/F Vt+A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=hv8olSRs; 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 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si132363eju.321.2021.03.30.15.26.06; Tue, 30 Mar 2021 15:26:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=hv8olSRs; 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 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232793AbhC3WZA (ORCPT + 99 others); Tue, 30 Mar 2021 18:25:00 -0400 Received: from mail-dm6nam11on2085.outbound.protection.outlook.com ([40.107.223.85]:36864 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232607AbhC3WYo (ORCPT ); Tue, 30 Mar 2021 18:24:44 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eMn3VUBk4B4lJfTRC8LRx2nXCvK5xkillR4G5BfUTX710Dcs3spJniWHl8bjvc8Ozc8om7xY8vjmwq1I0wE0kH1iwM1P/rozauX5We9SHDfhOpnHizb/mLZCmBjp31cR1Hh4Y8KeYUkPJYLH48Hf7gHnuEVAZrT5d8N2ZHiTKUtaR0BOwklU16QeLNl/XJLX+dlDjFXHUz4ombNwrmh2NGu/1c2y8xKyznlWopx/sV5JztDicSYM9cc+j6YCFTQzGOoyfkzAK7q/l+OhZcFo6UvsDrvqAvLU1eaPSze0+7F0XOnDO+VdUu3uIpabvSbrLUK98sJXkXZE40gHvI3dog== 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-SenderADCheck; bh=w9ukJXfq2a6VQdE00YdgAIqNmhLcocMcEz1uqfCRjW0=; b=imYjZSaNiKUkDuKtiFlddejNVHiTudwBj75AvtZ/rmlEDRyfg3WUTJnWCizuKHxV0LgRgsjKEKcGcdiRFUK9ZZOGfGa+abiE0cyc4a5UXBk99cn2H9N+lANNqJAoGtf3nx2iLTlG0hBvWfGcXwH/X+MHIiEbQWbhl6s6jFRODR3cRAYDwg1bafiNXeHr7xnxCziwTd+fFKHAqMy7e+zbxB1F2ziFNEdg6I2dAGUVK96H9X9GC9BPL3jRKmAGe2Bidk1YPe0KZ1T9UEdvvIWkRGizrzH+HKakjUfOiyk9YTTpyltxguQG5DIhuomOZ3VPCGMFYcFc15XD1Xp1ILEjCg== 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=w9ukJXfq2a6VQdE00YdgAIqNmhLcocMcEz1uqfCRjW0=; b=hv8olSRsCv30ceK1wFEhlmtFkP/Dt2hPvC90xfsvikiRE8jdn9V/3ve/GhD6W6jgReykPENgDV9Xt4O8DTvyGF33Zeh9K7mEGmqVsVQFbZVWDqQBlDqzekMAfT8a2o0Qsl0fxP2l9GofO/BmErD/En51FM7kISYSlCmCwYYhRKBEAtfAJi+5ubm5+b4aAHaO4lgfG5gjmjnEvbZSpxOvshqIuaWnD6aOF47srsJZFdhndXFNta6sH74QHPK2okwA4TMpoffg/OrxYdhfhNTRKAZLCZv9m/szO1Wl810nwGFpA+ioQe/eZyBZ1NbnRCR6X703axR1RTJGiNnW85SW5w== Authentication-Results: nvidia.com; dkim=none (message not signed) header.d=none;nvidia.com; dmarc=none action=none header.from=nvidia.com; Received: from DM6PR12MB3834.namprd12.prod.outlook.com (2603:10b6:5:14a::12) by DM5PR12MB1754.namprd12.prod.outlook.com (2603:10b6:3:10f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.29; Tue, 30 Mar 2021 22:24:42 +0000 Received: from DM6PR12MB3834.namprd12.prod.outlook.com ([fe80::1c62:7fa3:617b:ab87]) by DM6PR12MB3834.namprd12.prod.outlook.com ([fe80::1c62:7fa3:617b:ab87%6]) with mapi id 15.20.3977.033; Tue, 30 Mar 2021 22:24:42 +0000 Date: Tue, 30 Mar 2021 19:24:40 -0300 From: Jason Gunthorpe To: Alistair Popple Cc: linux-mm@kvack.org, nouveau@lists.freedesktop.org, bskeggs@redhat.com, akpm@linux-foundation.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kvm-ppc@vger.kernel.org, dri-devel@lists.freedesktop.org, jhubbard@nvidia.com, rcampbell@nvidia.com, jglisse@redhat.com, hch@infradead.org, daniel@ffwll.ch, willy@infradead.org, Christoph Hellwig Subject: Re: [PATCH v7 3/8] mm/rmap: Split try_to_munlock from try_to_unmap Message-ID: <20210330222440.GC2356281@nvidia.com> References: <20210326000805.2518-1-apopple@nvidia.com> <20210326000805.2518-4-apopple@nvidia.com> <20210330184903.GZ2356281@nvidia.com> <12442194.rtmf8Ope3M@nvdebian> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <12442194.rtmf8Ope3M@nvdebian> X-Originating-IP: [142.162.115.133] X-ClientProxiedBy: BL1PR13CA0413.namprd13.prod.outlook.com (2603:10b6:208:2c2::28) To DM6PR12MB3834.namprd12.prod.outlook.com (2603:10b6:5:14a::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mlx.ziepe.ca (142.162.115.133) by BL1PR13CA0413.namprd13.prod.outlook.com (2603:10b6:208:2c2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.16 via Frontend Transport; Tue, 30 Mar 2021 22:24:42 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lRMmu-0066QV-Rf; Tue, 30 Mar 2021 19:24:40 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f2b1a49e-95aa-4fbd-8134-08d8f3ca9d80 X-MS-TrafficTypeDiagnostic: DM5PR12MB1754: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I6nNehQMKpEpR3jHWxwH+b2aWivTRHhOEGcB5lnTB3HHIGErY4xSy5yy5FcZ7Oh7ui3zEf6r3X0dm0yXAqsKH5zZQVuz8A17xKsvSFWc3Nw/OeyR0YBJLw6aQmogSISnX1yAMQVMWs9zS5W9qrpPHIzZy7NwPRU2lcI8xLlfeiYLhE75oEEXK50Kggs0gXhunXaS5nGvo0Ke1nyg/93zTaNIi4TwV+sUcDcFEF42B4p/MUyvmoRvUp/lYkwia9GESvkcGLfDw9Y9R8DrVRlTDkB9/g/8sIlygbpn2AI/JWla4S1+MhUDzu7kmnnhnN5VKhbXwcKJupWWOYGqsUwi9m5DxNKlon6ktSaeOK+ZpDrjC3gwrEJksqH+DSUM9qd4HRV9ZUn3OGKl8prWbR6GABzfozeA8LE4AwTtigXuUrWKBEqdCpA0p08HIxSa+ysOfSeh476jgC/f3KGuaraDlzTGSOQKmjUx4SEC6Bf+oD4PC+mofpG1aUnhaeyaO+R1z1REhXBQpTvCLpQuAnKPbzVBOfXqRFjF3nPztTQBU4WGUhjLQPAWNbasCfOWVnse4qrYdTgpBnZIWJ+jtZNYGT2TgTQPEepgJHUBTt1Bbn60xjB697Cd1OBa0eY9BgQDE13Z2/7Fbxbiw5L3JB+HRs6i2Ql+4eq8DXV+zQq6r3k= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3834.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(366004)(136003)(396003)(39860400002)(376002)(6636002)(6862004)(478600001)(66476007)(7416002)(1076003)(37006003)(38100700001)(2906002)(86362001)(316002)(9746002)(8676002)(4326008)(9786002)(66946007)(8936002)(186003)(33656002)(83380400001)(426003)(26005)(36756003)(66556008)(2616005)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?fVV59dARpSdv2KxCT3izOPfwZRgAEWGURqY+te/YBVuRMmt1efCxeEnbyMD/?= =?us-ascii?Q?aw4SmbiEL1w+qnhPB6So/Jwa8ymMxlRYIH/4+/hSKi1hXQCZgp0jeI20QUSv?= =?us-ascii?Q?Jzcyi/1xsb5iS5t+YEZlso12CGO9vVVW7Xefl66E2LoIi38vh/nQr0yPoGwI?= =?us-ascii?Q?L8M5j4gPDPooa9RVV8u/Suara5ChyTZHRjBQodRAWK0ruSP1PRcu8b6NwiGH?= =?us-ascii?Q?YTgaZzjF18SenIYavDOHKFNP5Cd0jf4YRTgScnGbuZDzDWA7Nf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zW/bRqOQ/QBpYvLTK2nk1z7cCq/rQ?= =?us-ascii?Q?KJpdMVzW/GpJcFqmDrtBW1UU7N6Gawta341Q7qpBQ590oVRP1vFsWKWse/8N?= =?us-ascii?Q?Je82TJyO0PamJZ7BbLinL9uBf76AJccfLWvBpNH9gmcSobqo7lVTrbAR4sVr?= =?us-ascii?Q?NsqFD+ow47xq7YX7BBCvtUm5aUuJyXN/5PHSew2DoGvZ9g=3D=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2b1a49e-95aa-4fbd-8134-08d8f3ca9d80 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3834.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2021 22:24:42.6591 (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: cSGcLMR/MmgSJsDLj2FHsePQyW4mfJUtLDSpS9XZjwyDvZZHFJRzHfWMGzZlIJir X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1754 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 31, 2021 at 09:09:30AM +1100, Alistair Popple wrote: > > > @@ -1796,8 +1821,7 @@ bool try_to_unmap(struct page *page, enum ttu_flags > flags) > > > void try_to_munlock(struct page *page) > > > { > > > > But this is also called try_to_munlock ?? > > As far as I can tell this has always been called try_to_munlock() even though > it appears to do the opposite. Maybe we should change it then? > > /** > > * try_to_munlock - try to munlock a page > > * @page: the page to be munlocked > > * > > * Called from munlock code. Checks all of the VMAs mapping the page > > * to make sure nobody else has this page mlocked. The page will be > > * returned with PG_mlocked cleared if no other vmas have it mlocked. > > */ > > In other words it sets PG_mlocked if one or more vmas has it mlocked. So > try_to_mlock() might be a better name, except that seems to have the potential > for confusion as well because it's only called from the munlock code path and > never for mlock. That explanation makes more sense.. This function looks like it is 'set PG_mlocked of the page if any vm->flags has VM_LOCKED' Maybe call it check_vm_locked or something then and reword the above comment? (and why is it OK to read vm->flags for this without any locking?) > > Something needs attention here.. > > I think the code is correct, but perhaps the naming could be better. Would be > interested hearing any thoughts on renaming try_to_munlock() to try_to_mlock() > as the current name appears based on the context it is called from (munlock) > rather than what it does (mlock). The point of this patch is to make it clearer, after all, so I'd change something and maybe slightly clarify the comment. Jason