Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp209234rwl; Wed, 4 Jan 2023 17:55:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXsxwwMaYry8Lz1d+WeYK3bzhtnK5Tt77rZxKvdBX3jbIBO+pU0cAsfpf4LNPRC+4PY4QYcD X-Received: by 2002:a17:902:d491:b0:192:ad82:dc98 with SMTP id c17-20020a170902d49100b00192ad82dc98mr29047508plg.34.1672883740284; Wed, 04 Jan 2023 17:55:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1672883740; cv=pass; d=google.com; s=arc-20160816; b=rm4OsJ0xpB69o6J5KA3D3eOGvtwD++xoVbLaCQIseQENk24kI0ffSVzq0vZ/vnXVF9 Ob8gRkGLugAJe/Pdew/N2ymI37eFPygroO0O2AcOEi77BF1gBBsEznfIz8RHC+rU8ePu v327RccQj8a01dMalnLDUm8muxpXp5v8GHSEFHtJzAbidD4BcG/cCKWbT8YfgdEqm0en C85HVy2JDWhcrEjaiDoMebaMg8VfrcGTWuGaMzEJxjin36JvAvZSBa0TjS7w89hxCzL6 i3FCKoQpJDwMpKtxx4nsRE6svWxx5r5+qSq6ouS83lRWnVkaNYLmw/cPxaKPuJI8lC5v Othg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:in-reply-to:date:subject:cc:to:from:user-agent :references:dkim-signature; bh=JQskZp85qdJjpQEJ0BKPw+RuSg+mJk2lJ6fc9hmNchs=; b=TdkuG2bzsp4C9Xqj9F1RFLtJmi2G/7lII0FUyxvHw8Lsj4OQ/07OFEobaOxbl/oz// ePsdASzZ7zHJ0ZaTybsYkk5wyeNH+5SiipZsziAjZHPRtjQS4TNn7mAvZamDnRrEv0u7 9FqzOj8XGZBfKPXFXkccKmISwF1QnEivj66By0aM3pBJWbzV2azZGfq7MOrcDEbsO7ac SSBvZCpVa63cgs9WBDj/ZakcatdNIIw8JsZ44AuIW2xn+ZjfueJyUBfeM/Feac4XaUI9 tVTx59+clMByA9kRM8y16P2xEb6y6LK4lhfvNVFvKzJBjo+0U/E3JZcDisG83lGVRqJA KecQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=n3Qz5M95; 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 e8-20020a170903240800b0019269969d09si31000459plo.319.2023.01.04.17.55.33; Wed, 04 Jan 2023 17:55:40 -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; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=n3Qz5M95; 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 S229831AbjAEBVW (ORCPT + 56 others); Wed, 4 Jan 2023 20:21:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbjAEBVT (ORCPT ); Wed, 4 Jan 2023 20:21:19 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2080.outbound.protection.outlook.com [40.107.223.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A25472009; Wed, 4 Jan 2023 17:21:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CiC/ecREwZHzv5DdqPUVRzjQBVBkYLIRxrICIJ2gFNclQSMKlx7d5AftXjb11XB+29bXRTO+PNZ69C9rXeWDs/kvjiRAkPAmsbcWsDOtp0+5p9nFjDNoG8sZMZ6tHU/drc/e1vc7O2mjNnaglboJKdrA/XGRZjluHQhgnId9zM1VKf3QEvYZyRImubFuydEMEuWq05GhDPxS+w4LYqwEouJ3HfuA5fFufXjeMCbR+2nRUiwmQQNiCSGjHGmYjW1IGiq2XvCxmDUYyvo3VDydCZOpnzQut/eTCpXcLfqyVzbE3fX8O5dYFHIeueVTCdIt2c96EWqnkx+ijmjV1wLBAg== 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=JQskZp85qdJjpQEJ0BKPw+RuSg+mJk2lJ6fc9hmNchs=; b=GMLOV6ovQxMocF3Lh11AcGfVW/MPso6ogxN+RJGUUEmyKpmeGsCwYnCFjB2xOhyeqovGcoBGT+lLW01gzeXeAFQzSuX5lquPX3sr4vjoYEfYipkuL2HSl5dxIe8nGUQ0a0fcFhSdH6jgkQi2NdhnlpmOWFAdNbpELl39RDNtTJO89qiA8y2Ik5fPBsxDZDjIusOgt70o4Ux/tpm4tv4f+hZUcN3J7aMOFv2hC6xra5Ym2c9y0z8bdDkQEUzC2cHMxzAbTXTZ2kaR99RN/FBfW7uTBQNzYlERN0nEE4RgszZc51uOamxPFNcTuOc/Zbx6+WWj/voQzNz/5rTzbcUMgw== 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=JQskZp85qdJjpQEJ0BKPw+RuSg+mJk2lJ6fc9hmNchs=; b=n3Qz5M95jduH6KP1NqALGoqG0uUKwS6ETQNN6q74NT1StRAjBfoG39nqy3PWPzU0TELqEZM6MI+0J8OnPUnQzzkOJChf1veh4Gloxn4RTi1euuyQSDKXi8toD+AOZwWpN6jb61V3+v9B7/YtAaH6EzG2VjjuFkiJwcrjjGbmnVrXuuTLGg7vkDZTAzJkz/T+tEB9VHO4bIew0sf5ei5xseJ2h763kN0mmGKTHsd3hBRDI0z/PdMwb9JeEkKvC7PS1j4WgYCjjhfEluImDi2vXW37i7wEMa8GbrOvLr7R6F8Xgf6MiPvH2FLCB2HdKotD89y4Gtr43Zc//lz71vPxPw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB3176.namprd12.prod.outlook.com (2603:10b6:a03:134::26) by BL0PR12MB4913.namprd12.prod.outlook.com (2603:10b6:208:1c7::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.19; Thu, 5 Jan 2023 01:21:15 +0000 Received: from BYAPR12MB3176.namprd12.prod.outlook.com ([fe80::ecfb:a3ad:3efa:9df8]) by BYAPR12MB3176.namprd12.prod.outlook.com ([fe80::ecfb:a3ad:3efa:9df8%3]) with mapi id 15.20.5944.019; Thu, 5 Jan 2023 01:21:15 +0000 References: <20221216192012.13562-1-mike.kravetz@oracle.com> User-agent: mu4e 1.8.10; emacs 28.2 From: Alistair Popple To: Mike Kravetz Cc: Michal Hocko , =?utf-8?B?SsOpcsO0bWU=?= Glisse , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, netdev@vger.kernel.org, David Hildenbrand , Peter Xu , Nadav Amit , Matthew Wilcox , Vlastimil Babka , Rik van Riel , Will Deacon , Michael Ellerman , Palmer Dabbelt , Christian Borntraeger , Dave Hansen , Christian Brauner , Eric Dumazet , Andrew Morton Subject: Re: [RFC PATCH] mm: remove zap_page_range and change callers to use zap_vma_page_range Date: Thu, 05 Jan 2023 12:14:36 +1100 In-reply-to: Message-ID: <87bkndvks7.fsf@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SJ0PR05CA0090.namprd05.prod.outlook.com (2603:10b6:a03:332::35) To BYAPR12MB3176.namprd12.prod.outlook.com (2603:10b6:a03:134::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR12MB3176:EE_|BL0PR12MB4913:EE_ X-MS-Office365-Filtering-Correlation-Id: feb7a98e-c59a-4bff-9c3f-08daeebb23d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ftSKaxtp4Fe0L98M+VwsC+7qeHjI4/mavGJXlF27OfSzLjLAzX20TENea1Uj0U7m6X+RGsPSdogPWPhxO6pzOAC4dt001uScq1gJTAITRfiQMKhioKw59f1qvULwSbbw4BIZ+b80sQwBNWR101dninY4/Gm/zfnEY+1JtycZarkAV65eGgfllGBoF14SVX58wlLVEjhjFAW4/iQILHs43GolcTKsKcGBCXPpqHj2cYGNhIj97ipg32eAwGg2gzRADS1gDgJsoYUl7efoCbHP4buP6FGnYfNawqZedlygnmrwj5oZyqokTA1L3SLxMfpSfRtqTUITdt+PYAjbOuQgbMMSae3sTIhN9tqQkfrI89pyr/EgLUxV3m5u9q3bR4sTXpnaCh+e9kqPtXgXCcAMa78Zs8zDuV8dioePVRI6TxA3g6b+VQOEdS5ElMfJwlo3phfjBQwhmngsyXR57X83RmSBMm5Q82WMLboJxmMTQC44gNDQr87zPX+eaM6fvi3bsZlXBjohm1pVQFX9M5kzeSTJuxaVgiOKV+tRulAe9sv3uITVP1OlnNj8HKVf0wKZlXwIHfD+6QZhITY4pyO/BZzPjc7TiOQwqmmzTkvRCd4dYzrsfFeM+7VVns3hO0NSZssVC4xVhzqGqsKepW8vhJ1IH+Tg08aCtXKpfWlYyYLSAee+npYdVBK3WJ6NPF6AKhBDm2GBLl0oCTAWZpEtog== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB3176.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(39860400002)(346002)(376002)(366004)(136003)(451199015)(2616005)(66574015)(83380400001)(86362001)(36756003)(38100700002)(2906002)(6916009)(54906003)(41300700001)(7416002)(5660300002)(4326008)(66556008)(8676002)(66946007)(8936002)(66476007)(316002)(26005)(186003)(53546011)(478600001)(6512007)(966005)(6486002)(6506007)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YU5kRWdZWVhpdm45WTc0TldldmRiYlhnb3ZTK1JXTVdsWEZCQWk4K0ZEWE1L?= =?utf-8?B?d0xpeDJvSWV4TUFDbFMvS1d4ZFdIUkoxdnpiYkJ0NUxqaHdlb1gwQUpKRXFM?= =?utf-8?B?UjN6OC9MZ0RETWplUGNQOU4zR2RlazM1akFvRUd6UHpRUlJYMkpzZVpMamxt?= =?utf-8?B?WnVzRURIYmxmcnVWRlc3aG5YTzVhSmNFblpjeE5wUkh1ZVFHQmhHZ2JiUHZH?= =?utf-8?B?VlBpR0ttc3BTU0k2L00xM2RoV3VlWlVDVXFMeGlFZm51SjFZWWdQeVZVTko5?= =?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Y5MDFnWHFPQ3B3N2JETVlSaVgw?= =?utf-8?Q?GtsSAXoANVX8ukXZZUdVakW7p?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: feb7a98e-c59a-4bff-9c3f-08daeebb23d0 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB3176.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2023 01:21:15.5702 (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: NfPiGGIpTyBRdhKV3uOxQH9Lh9YyGg4y7iW9/NtRgYvCEBj/BzI7e4XNwy3Sdig+7DcWtUCaEXeLb+mFwxjZ5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4913 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 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 Mike Kravetz writes: > On 12/19/22 13:06, Michal Hocko wrote: >> On Fri 16-12-22 11:20:12, Mike Kravetz wrote: >> > zap_page_range was originally designed to unmap pages within an addres= s >> > range that could span multiple vmas. While working on [1], it was >> > discovered that all callers of zap_page_range pass a range entirely wi= thin >> > a single vma. In addition, the mmu notification call within zap_page >> > range does not correctly handle ranges that span multiple vmas as call= s >> > should be vma specific. >>=20 >> Could you spend a sentence or two explaining what is wrong here? > > Hmmmm? My assumption was that the range passed to mmu_notifier_range_ini= t() > was supposed to be within the specified vma. When looking into the notif= ier > routines, I could not find any documentation about the usage of the vma w= ithin > the mmu_notifier_range structure. It was introduced with commit bf198b2b= 34bf > "mm/mmu_notifier: pass down vma and reasons why mmu notifier is happening= ". > However, I do not see this being used today. > > Of course, I could be missing something, so adding J=C3=A9r=C3=B4me. The only use for mmu_notifier_range->vma I can find is in mmu_notifier_range_update_to_read_only() which was introduced in c6d23413f81b ("mm/mmu_notifier: mmu_notifier_range_update_to_read_only() helper"). However there are no users of that symbol so I think we can remove it along with the mmu_notifier_range->vma field. I will put togeather a patch to do that. >>=20 >> > Instead of fixing zap_page_range, change all callers to use the new >> > routine zap_vma_page_range. zap_vma_page_range is just a wrapper arou= nd >> > zap_page_range_single passing in NULL zap details. The name is also >> > more in line with other exported routines that operate within a vma. >> > We can then remove zap_page_range. >>=20 >> I would stick with zap_page_range_single rather than adding a new >> wrapper but nothing really critical. > > I am fine with doing that as well. My only reason for the wrapper is tha= t all=20 > callers outside mm/memory.c would pass in NULL zap details. > >>=20 >> > Also, change madvise_dontneed_single_vma to use this new routine. >> >=20 >> > [1] https://lore.kernel.org/linux-mm/20221114235507.294320-2-mike.krav= etz@oracle.com/ >> > Suggested-by: Peter Xu >> > Signed-off-by: Mike Kravetz >>=20 >> Other than that LGTM >> Acked-by: Michal Hocko >>=20 >> Thanks! > > Thanks for taking a look.