Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1334369rwb; Thu, 10 Nov 2022 14:47:41 -0800 (PST) X-Google-Smtp-Source: AMsMyM6krs+ueHCXsoYwvm9buMYXWSJ3PcGXXDzLY2nmLPKR4uA4Fww3aAapQVcHb6a6IpbT5ksy X-Received: by 2002:a05:6402:1592:b0:461:c7ef:b09e with SMTP id c18-20020a056402159200b00461c7efb09emr3759468edv.58.1668120461540; Thu, 10 Nov 2022 14:47:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1668120461; cv=pass; d=google.com; s=arc-20160816; b=WM0OTLjWKasyRNYLJK0JG5qHV2nXqlhZF4FUTrKwS+PDLlTiBPbwwGNCHrEndzag8f q18e5XRDcSD0ZOCdPJONJ+Fri66NbDDrqyqchGSTud9QFtHmM/YFzkwYfvwTp8f5CBWF LGxUTujEj5x000EZuv5+Ls+WMDDR8nzTX/fMSSudLvVaaemTjJnFq3DOYpX2WCrbAOHm gYrX68QBqkCTdpXRPq+8hHpeMXaj7N5A9DO9h9wWes4LUhyjIba2zIHAQLSYXwiN6Ru4 Q05BWREteqO/n/3IZQqeBIl5BHVTwCB+6aA67NKBNKpYWgrqveqPxY4PjMdscC44MOys AzcA== 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-transfer-encoding:content-disposition:references:message-id :subject:cc:to:from:date:dkim-signature:dkim-signature; bh=3EgRGDcmCoqGPwIBAL592LVO56lyJUVy79wdvS4VM/4=; b=Sqzpz/fZ0njdQ4rGLYeui8Kb0/EjfU+8Gfxw480XDAenkjKx6/K9Wl+PhROZxHLsbq qK541NkQ0wxaC/zhgcHOCa4lwM2AkGjvi11zS9YkzAYVPU7Oo28fDMjBtnwjS3wNoC1O xRQYmbHzTFtRxXGqV9QZ5lkSJxpGTCvFPjFkNflOaLEGflTFJswJbXjMojB0HyfOHCN9 GwgcuecddxYLdlGwUR1mq1c/eCGYiwtj2zPzL4qZl/37yLkrRK4yyHLZbP4x069W1MFo 8P7LgQcPAlXEGLZAylw9fztgQofxIyKFFH1SwkLEkEURcWzLFvx1BaAp76kg9BhI8BrV vPsA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=nUtJfP5R; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=BeI0Wuxq; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.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=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds7-20020a170907724700b00781df60a2c8si554293ejc.342.2022.11.10.14.47.19; Thu, 10 Nov 2022 14:47:41 -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=@oracle.com header.s=corp-2022-7-12 header.b=nUtJfP5R; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=BeI0Wuxq; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.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=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229790AbiKJVuf (ORCPT + 92 others); Thu, 10 Nov 2022 16:50:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229566AbiKJVud (ORCPT ); Thu, 10 Nov 2022 16:50:33 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3130845EDA; Thu, 10 Nov 2022 13:50:32 -0800 (PST) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2AALNAsA016673; Thu, 10 Nov 2022 21:48:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : content-type : content-transfer-encoding : in-reply-to : mime-version; s=corp-2022-7-12; bh=3EgRGDcmCoqGPwIBAL592LVO56lyJUVy79wdvS4VM/4=; b=nUtJfP5R/IFoRWoF+iTEly0VKFTolRl3Rbkyypq1TYQw0UgR1qsBRo4ilhbO64rriTuK jKj/MXwSA+y0N0XhjNzehHQS9eQYyEUbUf+PVqN1XkCQLW8HkqT21uZVHAo0CcK0gkS3 0lOqNpmcLQoccxfLvA2BJVYxh/VbKswqRijOgl6mCMn3Jk7JQhCYDu269iToUbeVV9Zi xSlirs+JLVh5p5voUtOc8BrBW13J6PZBPUG5h3gmLc8qfh6qogc8pfxvkS/7F8ltIVvG bbtDlCpb1MlFSNvDGo3N3Fy3wdh73h13okX8CqhCMmXTYUNwXEWQYZzW4oPsHl7ZD7+J Qw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ks95nr2y6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Nov 2022 21:48:14 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2AAKcnWQ023222; Thu, 10 Nov 2022 21:48:11 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2041.outbound.protection.outlook.com [104.47.51.41]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kpcysg5nr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Nov 2022 21:48:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EeJRl5WiDrae0mj6we4RDkK+jvoGwpwhwNn6v+8MTFvMRgov2KmR1aMdBwdRVArV+zXkyKwjH8VfEcqXdnGpdDNbavA9ApyYRTFsup0A56qcRrNfjC2Jh+m4gwkDunMAFsT9Zpd/SMtJ0xDiEt2bBqHut4SHJGUWWoyZVRQF7TQvqdZkD5DQ3BCOS/n/juU/Aa2Kmlxw1rw0oz0YFWI1UuzX9ytItOFyy9k8sv3P2NhlgJ6gmUhssAlYEHd+5lR0U2WfdsubU3uewJIN6jXKZFhSKOmzEPv5XYebUOqnprbhQeRJUPp4U99pHb3eLP6Hc0tj9mUcXfClrheuA8AXUQ== 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=3EgRGDcmCoqGPwIBAL592LVO56lyJUVy79wdvS4VM/4=; b=iZb4HYKeBS4yKWpz9IAnEwdlvAXz8t3a5uehNezDhDMutuYFI7AXX+73sBEa3s+j5Vk5HYjuCdVIhjjqU2i6DOx2DCYDg4ZqE6DdQiGTpCziwacsHtIkkvzRUetXxWuxpuDCDwQFpFl1FMJ+X1n+9vxhXdwAtHqOIT6JsNuC/sIg83jt+vWQjNVeNL48tPeB1G+RpP2BLFXCZRzncG78evk9doKrLHxDVTRvY5baBDARryP38xUe3TVnpRzqOavtOAwayd6FZaXlM3ZyXDPwYsNCRFB0RWPIcFwgsAn93hguKufHuOr4OLMaDVnh9xovTepAc09equX8t+uhkmNXVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3EgRGDcmCoqGPwIBAL592LVO56lyJUVy79wdvS4VM/4=; b=BeI0Wuxqfje/2GnV923Tm03Bo+whohf7kKpzUMM+U2wtrl78auzLy5xLrvdLK6T9w4bdSQB0CWRCTjs2P2MFausdDZxKuU/dh6VsPmHCR4q12R84qEcrVuhh4drLnbnAZ+Aw5sKm+FsPonEG5bHenh2NDYRJ316iAL/zLTaom5I= Received: from BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) by SA2PR10MB4809.namprd10.prod.outlook.com (2603:10b6:806:113::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.13; Thu, 10 Nov 2022 21:48:09 +0000 Received: from BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::8d67:8c42:d124:3721]) by BY5PR10MB4196.namprd10.prod.outlook.com ([fe80::8d67:8c42:d124:3721%4]) with mapi id 15.20.5813.012; Thu, 10 Nov 2022 21:48:09 +0000 Date: Thu, 10 Nov 2022 13:48:06 -0800 From: Mike Kravetz To: Nadav Amit Cc: Linux-MM , kernel list , Naoya Horiguchi , David Hildenbrand , Axel Rasmussen , Mina Almasry , Peter Xu , Rik van Riel , Vlastimil Babka , Matthew Wilcox , Andrew Morton , Wei Chen , stable@vger.kernel.org Subject: Re: [PATCH v8 1/2] hugetlb: don't delete vma_lock in hugetlb MADV_DONTNEED processing Message-ID: References: <20221108011910.350887-1-mike.kravetz@oracle.com> <20221108011910.350887-2-mike.kravetz@oracle.com> <9BB0EA0C-6E7C-462B-8374-5BFEC34E8415@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9BB0EA0C-6E7C-462B-8374-5BFEC34E8415@gmail.com> X-ClientProxiedBy: MW4PR02CA0021.namprd02.prod.outlook.com (2603:10b6:303:16d::31) To BY5PR10MB4196.namprd10.prod.outlook.com (2603:10b6:a03:20d::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR10MB4196:EE_|SA2PR10MB4809:EE_ X-MS-Office365-Filtering-Correlation-Id: cd050d71-82e3-4bff-1c65-08dac3654224 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8OGy20fBIpqAjvCWlf/5E/owOySj3lCk2inG652hct04hCXDII+b46MwuJioTqaf+XpnlTdGRXGI/xiFZxjjUS0RxKorbHgAcHD8DRnagJYxO+OLKMhm8lxSM+FCiYF4y6QBFfjG9waddxHoUa+UeCCX3C2/T0thIfw0nRVL9VS8ck2W7KiQKXH3faU0n6OukAqZipBkwGifoLsibpFa3QV4R3wIn0MhPjVJvfftR5RCnP9DFcxoajAAAQ35hr8vLnTPXX+7YjSQOXIIhI1CqS9Fo4RTz8mhsEXs310QNxk37B0U/W3dTr4oRhQ363qan9TdFoOmq77EKx+KkVlFj17553mWKrrus4zocdvJq7LAd/JI/yu3b1KqO4BAs3MS3+QZw2DyriXLfaOvTQha5+ejPTWp1KoGSZXe6YzqlZUQ00QSzlgm7zQlwKKm9HYNp3jRyL2p8kClGMrEuBClyc/LFqyiaOzLqDwvOtoADkjQuCTCTIfZT7azzR7n19hdMp3T13aqE6K3DIaHtlcuvCqu1h8b4Ai7YgHGETrsHPl1DT8mkNUgmnHIcqVTiNdknFAEUtQf8x8+w7ZCDBiKNJDDa/lwKpLt22HsX0A71hLmQycKgWdclJ2NbdQwv6OcEcR61x7WGbmzRaS5QFIpfaNBP74zHvaAc6GZFvD7lZJL5fzjjMhmmI6u93j9/7mWqGmRVfrtSdKOG+Hfk/khTg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR10MB4196.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(7916004)(366004)(396003)(39860400002)(346002)(376002)(136003)(451199015)(53546011)(26005)(9686003)(6512007)(33716001)(38100700002)(8936002)(83380400001)(186003)(44832011)(6506007)(2906002)(41300700001)(66476007)(7416002)(5660300002)(8676002)(6916009)(66946007)(6666004)(66556008)(4326008)(478600001)(54906003)(316002)(86362001)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NWxUbmlKMTNlMDMyMnE4Y0EvWDRYczhtRFhTYjFURUVFaFVhL1lPSDNUUWgv?= =?utf-8?B?ZTFBL28wREJZd09oRzdDZ3RXTkp1aW9GMFQ3R0E3aE4yQUppUGI0RXhrQmhi?= =?utf-8?B?Z1l4NjA2NWJOWEZmVWZjZzBHMncyTnVXb3o1cmtNTm9PT2pKZm94SjRNYWpR?= =?utf-8?B?MjQzZzUzbFV6bXNhdzlTcXhnWmhHVmRuNXR0Z1UxSFRXcVRuUlowaEhVNVRJ?= =?utf-8?B?VURiR1JYWE9VSTRYczRGS3V5bzZnSUMwVVUrNFJwSnYwVzQ3U1dyYjhXRndD?= =?utf-8?B?b3N1VDl6MVlsby9mSjJyTVZQU0dyeCt4dGhxT0IreGlrM3lucnRzZk9QYUM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uQmFVQVl5Z0VFalRNbzhibGtGNGhndHhEZm0xeU1nYzd3R3hK?= =?utf-8?B?UWc9PQ==?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd050d71-82e3-4bff-1c65-08dac3654224 X-MS-Exchange-CrossTenant-AuthSource: BY5PR10MB4196.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2022 21:48:09.7635 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WecISwHLIMaf3Y1iu6GI6pY65VODZY2msx/mkD5VwzFjTY1HHYcB/LumbQzTyL2J2mhxfzcDyyNNbeNZgJGUXA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4809 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-10_14,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 malwarescore=0 adultscore=0 mlxscore=0 mlxlogscore=962 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211100153 X-Proofpoint-GUID: teNL-r0dJZhm6nuRxriVEUW2yW3sNfCi X-Proofpoint-ORIG-GUID: teNL-r0dJZhm6nuRxriVEUW2yW3sNfCi X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 11/10/22 12:59, Nadav Amit wrote: > On Nov 7, 2022, at 5:19 PM, Mike Kravetz wrote: > > > madvise(MADV_DONTNEED) ends up calling zap_page_range() to clear page > > tables associated with the address range. For hugetlb vmas, > > zap_page_range will call __unmap_hugepage_range_final. However, > > __unmap_hugepage_range_final assumes the passed vma is about to be removed > > and deletes the vma_lock to prevent pmd sharing as the vma is on the way > > out. In the case of madvise(MADV_DONTNEED) the vma remains, but the > > missing vma_lock prevents pmd sharing and could potentially lead to issues > > with truncation/fault races. > > I understand the problem in general. Please consider my feedback as partial > though. Thanks for taking a look! > > > @@ -5203,32 +5194,50 @@ void __unmap_hugepage_range_final(struct mmu_gather *tlb, > > unsigned long end, struct page *ref_page, > > zap_flags_t zap_flags) > > { > > + bool final = zap_flags & ZAP_FLAG_UNMAP; > > + > > Not sure why caching final in local variable helps. No particular reason. It can be eliminated. > > > > > void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start, > > unsigned long end, struct page *ref_page, > > zap_flags_t zap_flags) > > { > > + struct mmu_notifier_range range; > > struct mmu_gather tlb; > > > > + mmu_notifier_range_init(&range, MMU_NOTIFY_UNMAP, 0, vma, vma->vm_mm, > > + start, end); > > + adjust_range_if_pmd_sharing_possible(vma, &range.start, &range.end); > > tlb_gather_mmu(&tlb, vma->vm_mm); > > + > > __unmap_hugepage_range(&tlb, vma, start, end, ref_page, zap_flags); > > Is there a reason for not using range.start and range.end? After calling adjust_range_if_pmd_sharing_possible, range.start - range.end could be much greater than the range we actually want to unmap. The range gets adjusted to account for pmd sharing if that is POSSIBLE. It does not know for sure if we will actually 'unshare a pmd'. I suppose adjust_range_if_pmd_sharing_possible could be modified to actually check if unmapping will result in unsharing, but it does not do that today. > > It is just that every inconsistency is worrying… > > > > > @@ -1734,6 +1734,9 @@ static void zap_page_range_single(struct vm_area_struct *vma, unsigned long addr > > lru_add_drain(); > > mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, vma->vm_mm, > > address, address + size); > > + if (is_vm_hugetlb_page(vma)) > > + adjust_range_if_pmd_sharing_possible(vma, &range.start, > > + &range.end); > > tlb_gather_mmu(&tlb, vma->vm_mm); > > update_hiwater_rss(vma->vm_mm); > > mmu_notifier_invalidate_range_start(&range); > > @@ -1742,6 +1745,12 @@ static void zap_page_range_single(struct vm_area_struct *vma, unsigned long addr > > tlb_finish_mmu(&tlb); > > } > > > > +void zap_vma_range(struct vm_area_struct *vma, unsigned long address, > > + unsigned long size) > > +{ > > + __zap_page_range_single(vma, address, size, NULL); > > Ugh. So zap_vma_range() would actually be emitted as a wrapper function that > only calls __zap_page_range_single() (or worse __zap_page_range_single() > which is large would be inlined), unless you use LTO. > > Another option is to declare __zap_page_range_size() in the header and move > this one to the header as inline wrapper. Ok, I will keep that in mind. However, Peter seems to prefer just exposing the current zap_page_range_single. The issue with exposing zap_page_range_single as it is today, is that we also need to expose 'struct zap_details' which currently is not visible outside mm/memory.c. -- Mike Kravetz