Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4602193pxf; Tue, 30 Mar 2021 11:51:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybE0Af65HdQieRhDsaI9K+2c3jN5lt9yYfEnIfwRzDq1GAg2dT3+9cXKe/zee5dmv4dc2S X-Received: by 2002:a50:ee95:: with SMTP id f21mr35735934edr.130.1617130261541; Tue, 30 Mar 2021 11:51:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1617130261; cv=pass; d=google.com; s=arc-20160816; b=1DsTZ//xlM0GjCxpC4FD1PMlQ53gDU3cU1R/raWVuARseEgOSjUlWxXgSPw61FfH27 7Qe8/j7Qu6mA3L51b1q7RYZjBE0TCr4AQb+zrIijQ0D+bj4q4XupAyXgJTTfIQCXaY2y q5ZqxRoan9bcwPBkQ3CrzQ8JKSeGPBMVwzawi/stTUA5JRckGV6ByA2u9Wsp4+KQXRQ3 JsXCjC0m9V/RSdpOWnOJYR7NZxdUOJ8QWgJq6XgkMYHnzOGbIZObFg/lhsLj98xpQAgK dJYSnVtZrThQPZBfQ+UmROrRhQPYUKg3LcOOOZOIn673xe2WT6uuxKp5s6yLrZNhyyRU KsNA== 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=5udlLvxI3MP/gf/TKC3f2iE+jHjQJnkwGLN47dqGSaM=; b=Tums1iXVz7t1MV7GJ12vcmYycs9FQDdAiKZQ0asdesLDha+Aj1faukKXuHXWTXAPVD +Uv5MSNuBBatuhMCEyi4I7rUzUP9tiFcN0I31H/wIFJcdN9XOS+ufgQ4dCIIAOMhIJ4a KuOm6y/swVYvNepokiyh+1bNxqbi3/dp2VliPtNJ5zTs9pJJl75rsTAOtZC8B68rUgF2 DrelQA2xD0HCuNXFKz9tY6U35AxfTkm7RmNz1otsSU4hAbUpwos0mLbjEDp2PkTHeKa1 1w734A76MHMQ20bl4wgL1QepxGhq72uyemjVBcB0F0eVnvnG+rqdosaj7EpPnkQGfCG5 5z3w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=Q+DqdgUU; 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 i14si16285651eje.519.2021.03.30.11.50.38; Tue, 30 Mar 2021 11:51:01 -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=Q+DqdgUU; 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 S232934AbhC3StY (ORCPT + 99 others); Tue, 30 Mar 2021 14:49:24 -0400 Received: from mail-bn8nam12on2060.outbound.protection.outlook.com ([40.107.237.60]:13888 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232927AbhC3StJ (ORCPT ); Tue, 30 Mar 2021 14:49:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L+U6drQHtbMEQ/HJI4BC0BhJQa3j/EFrQVkH+sXvVWIh4JvLsp40Rsd3L3Jew9nGVsz3BGNESdeCfbzz/dubPTXuMelUTi+MlcZUizcVWyBgis1BeS5vdjx1oLFS23P9T0uERX6JEwd6Czp4wbf3QmF6qT4pElFvfKortS0JrHFHJ+Tmb/yPj+8JiP5tOALvQzpYvmrSVECqfoFjvHBPZ8mHHlxrDjh2VIADFW7+cua5ejRHQ2Wp5JTvaE7b5hcbTw3duttOK0UH9nmF1YtSL+zgcS1gspilxqc7/1aA3s/hGCAc/a9c5ZQAuNrGRcIvMnVtrbpfz3Gf8FOYXuJCiA== 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=5udlLvxI3MP/gf/TKC3f2iE+jHjQJnkwGLN47dqGSaM=; b=WX0vugPxKz4Grbj/msRtAEH2lwYCPGgOw0t1f/2gF2PgOCft+0PpI7iqcr1GEC92z2lX1TJlwT71xYsUMHqyJB5fzvuZvtYALJu6uFa2rCTcj4Hkf+wb0Q2ooUnEkrHRWFdEUHA0R6w8cEX/jEzyHNVHhb1ptpzxITt/Dn9X/gs5f7uvz+Xf+JJ7xdygWmrMXZTwlhbcq/Q7yBtvIN/DSFn4QDMfr6tFMIaxJBrPZyxgvn5zoRu7bYhJy90mFERapF49KwgieIDEQPjZquE1hs3k54qEGGozIu1SzhajUCzvDOmpAJFvTVsFn9byn5BMo1G6TeB/es2GlmgCE4e7Bg== 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=5udlLvxI3MP/gf/TKC3f2iE+jHjQJnkwGLN47dqGSaM=; b=Q+DqdgUUJ9U/gOeoJSFLB0wMV3W3Ah4PeVzXwbJql1/BpW2yWWZuLzJkVSp7O8jBrqG6HIcb0M6DEhOtWM7jKgjPdh3gv8DeB9wDjzVjhGJOg1MpGYNGbbTFossFbjrBlQ1WPDGdh0oQteE7xDmaVKj6Y8R82z9Hf1WBKPuJTXZfUXoytGifStP+NirsFdoYznFzK8yjVC98biyX6peWOOKx15XGdsV38mZwmd2QBYSkpsV5spLLPjErxSusswRHnV+vz+5leQOe24HPoa3uwiozwES71Pgnypxh28sL+XqZEtI4ISInB+HhppTI+vdJcy9zalzYHjGq6t0smcr1Nw== 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 DM5PR1201MB0202.namprd12.prod.outlook.com (2603:10b6:4:4d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.25; Tue, 30 Mar 2021 18:49:05 +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 18:49:05 +0000 Date: Tue, 30 Mar 2021 15:49:03 -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: <20210330184903.GZ2356281@nvidia.com> References: <20210326000805.2518-1-apopple@nvidia.com> <20210326000805.2518-4-apopple@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210326000805.2518-4-apopple@nvidia.com> X-Originating-IP: [142.162.115.133] X-ClientProxiedBy: BLAPR03CA0001.namprd03.prod.outlook.com (2603:10b6:208:32b::6) 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 BLAPR03CA0001.namprd03.prod.outlook.com (2603:10b6:208:32b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.25 via Frontend Transport; Tue, 30 Mar 2021 18:49:05 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lRJQF-0060Fl-7p; Tue, 30 Mar 2021 15:49:03 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc46dc5e-64cc-437c-a3f7-08d8f3ac7e4d X-MS-TrafficTypeDiagnostic: DM5PR1201MB0202: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XJyR4MJv/43JkMYSUrm56Jv9u4vd0aIPwBRDnCLdDsdGUJP0oC+EKRbwxp04/HcQyAM1nWtxKcD2u0Rah41MxXDWZSine6PnNv0FM8rz4o9v+6fhdGppWuejrRxhbgl/MfXEhCaA0QZDZ0NdUZUKyeYjq3lWK/D/pFumJ+dLFSy5n6fCG5MxCweh7pBC3WMppRsAr5duv9fdEkKs4yv1jNnsA9g3M3e/7Fh+eEcffwaLHwDU+u3jEFm2Qg+j3NT6ai0sRT1QKsyDS/9ylxq1/64OFq8GGVh9dwnQbwrBnuSGfB4jLEv30FFg/EDelD4ykvJgy9fxcfU2LB3D+V7/zy9b43QXEMJOtMCaAgMxxMyaWEQm8NnTQ5lnYjI3JKJm/xKM48xXKzqMmrP7i5s7W82Ipd/KqL/lBWziycyMPWaE1Ae/hLNLS4q8mkbSj93dXj+cjzyjK3LHE6T83C9U+RrfuBDrXdRkE4NO5fFKixycxGVrzf6yPGoU56qQySjEJ5iB2UxXFA8zvRLm4u3QL/6tCNNGKlfPLgpVUcsvpVgFroFKXRi+I1NVUp4WuDZT9z8Mu2fVPPf8lV5RNpqoYFJKUs6ubXnVpaxCYv2hUpW252WYRL8p52J29YnJl9OMO20EJ5ID2VWWTNY3xmvrCssD2qTbP+VrkSNq8SSBH8Q= 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)(136003)(39860400002)(376002)(346002)(366004)(396003)(33656002)(7416002)(86362001)(316002)(9746002)(8676002)(2906002)(8936002)(9786002)(6636002)(478600001)(36756003)(426003)(5660300002)(38100700001)(1076003)(6862004)(2616005)(83380400001)(66556008)(37006003)(66476007)(186003)(66946007)(26005)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?wCbIMzJSgjSgNyBI/DcLzb2kD/Wr0yvpM5L+NHvfR9gn3ajdDqgtqigzmd+z?= =?us-ascii?Q?qUwQpm5TKdc54g/mWN+aZXFohgvdMSUJ8YsEd/oKyKuOJvOW1MMQqC+asH4b?= =?us-ascii?Q?IwOCMPTVP4PT6OzTTzsGgIOxw6zsoISMu0/vfy75hbJ+HC/0V/k7IJqnDHUg?= =?us-ascii?Q?PW9PrykxgnpUbHY/MIoIx3z2y6W0OMlt72l2cvDTHnY/duQwzTN6XJRoRULS?= =?us-ascii?Q?a7AxDNX+a9TSW+o+tPhNwkYM1oqRyXfoZl2QmCkb342xdjIdtDd6MZHdGl3R?= =?us-ascii?Q?iV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0EHQtCgin?= =?us-ascii?Q?LCy1MqMxj0CklN5Z7eCfxYgTQB7kgzYhH3q5JMwxzeeOuoFxi4g1PHaO6sUy?= =?us-ascii?Q?BJHlMs4mQ2Vy7PF6Tv/cz5u/OiYwN7fmNfdVHbSCXB8k9xrS5bZX9JNSD7yj?= =?us-ascii?Q?FY6LWHWTp8ao++JP+jKWEw/yG1X7dZIDREZaslWBORqoyw=3D=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc46dc5e-64cc-437c-a3f7-08d8f3ac7e4d X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3834.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2021 18:49:05.8343 (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: w+aDCrGDzh211idVdYY+Q5UWcUbAllLwASWx4KxgVAI518B8dRkEQ2MouwyvEb91 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0202 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 26, 2021 at 11:08:00AM +1100, Alistair Popple wrote: > +static bool try_to_munlock_one(struct page *page, struct vm_area_struct *vma, > + unsigned long address, void *arg) > +{ Is this function name right? > + struct page_vma_mapped_walk pvmw = { > + .page = page, > + .vma = vma, > + .address = address, > + }; > + > + /* munlock has nothing to gain from examining un-locked vmas */ > + if (!(vma->vm_flags & VM_LOCKED)) > + return true; > + > + while (page_vma_mapped_walk(&pvmw)) { > + /* PTE-mapped THP are never mlocked */ > + if (!PageTransCompound(page)) { > + /* > + * Holding pte lock, we do *not* need > + * mmap_lock here > + */ > + mlock_vma_page(page); Because the only action this function seems to take is to call *mlock*_vma_page() > + } > + page_vma_mapped_walk_done(&pvmw); > + > + /* found a mlocked page, no point continuing munlock check */ > + return false; > + } > + > + return true; > +} > + > /** > * try_to_munlock - try to munlock a page > * @page: the page to be munlocked > @@ -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 ?? /** * 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. */ So what clears PG_mlocked on this call path? Something needs attention here.. Jason