Message ID | 20230120162650.984577-19-Liam.Howlett@oracle.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp391911wrn; Fri, 20 Jan 2023 11:45:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXtPNUp0jlBB97XLjdF45arawwbgOFvTYbEZ0u9cZcr7HSc0xPn2amEWXWLMV+oSJHpmOFJA X-Received: by 2002:a17:907:7650:b0:7c1:d50:6dd3 with SMTP id kj16-20020a170907765000b007c10d506dd3mr17274491ejc.36.1674243956674; Fri, 20 Jan 2023 11:45:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674243956; cv=pass; d=google.com; s=arc-20160816; b=k0WABDuRAwGfo5K12w2Hc/ftB1cM+H1U6oX8VCL1d2nNPBkAa5AzGd4q46JoQunFeK 69ukm/j/Ywjk1++FL1ieOaePFlcKIiXhEAB/HBv+aKyU/b+L+zObaZasIl54wiLzPFwg meYMHdVBVAI4B1bHoTRSYgE0UriqAgPSDk0JCIVf54EpSGQx0b67DWI4qXp2B6PuF9/U 3JpjpKgXstvqN2yZNdExyssD+wAZawuEcvfAI+R33PpvcGzYebTVLIa3b7ANrHiC9scK IXCB/gdTrI+2KTH7e5I5ZjY9hyqrqEBTpPOAGprOiLh51AN8RwdILYCfW6TgGC9kjrEe RjLQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=xC3mu4AKsppqbyDSCw58mvfzh8IAlVWOVoZ5aweJCiA=; b=JNknt26KsIi/p/DkXtNLOD61yVA319SedlzpDiIPmhOxJjBIDY6QDB0aYic3aS2CpA 65doB2cYQylGm9gRAWw8ockDnKFKYxPsS4LRssi9AkjVndeb32qovx//3oKGJi/w11uu vwQGNEH5pV3guSH8tw6lzq/Qzo7NLngLEwb8ACwneRQiNyZfV9SRTTPbM+BbLFHoH1mG OXlXNX3qmY93EM4odDS3p4achHhZGUPnEV7ZtUNZNW9Zu1CLgr+tcIalk3EkKLKpcKgQ EfjMu/TQWrKsMww+v3rXg3fgJM+mN7lu1WeJhaaBup9RGvN6mBmcHdtCFIAmog37Bw3/ NFvQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=zMVvl+6K; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=HhDZiEVD; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho20-20020a1709070e9400b0087255f934f7si16049524ejc.214.2023.01.20.11.45.32; Fri, 20 Jan 2023 11:45:56 -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=zMVvl+6K; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=HhDZiEVD; 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 S229554AbjATT1N (ORCPT <rfc822;forouhar.linux@gmail.com> + 99 others); Fri, 20 Jan 2023 14:27:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbjATT1L (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 20 Jan 2023 14:27:11 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B3D6D0D9F for <linux-kernel@vger.kernel.org>; Fri, 20 Jan 2023 11:26:41 -0800 (PST) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30KGE89v024778; Fri, 20 Jan 2023 16:27:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=xC3mu4AKsppqbyDSCw58mvfzh8IAlVWOVoZ5aweJCiA=; b=zMVvl+6K/rTLeU7dmJtAyWFK+ltz0cAU/sPpg18S0y58UZjSZ3p2iQo17IJ3ABiNPome j0ZwY4jAFSWOdtw8yS/ZaCUyuieFWzGMb0BKGlLBiKhIMKwv2N98/NtPS2qinIfSlKW4 uuKMj/HEfTUdiXWKLOmjEPoeE9R9lVZoo1b9nX0rTr/qLAOhMqKmN7mUG2czIUoILZRm FBX/ON78LfoqAZvsJ6qC99bMV6TKfAf9t2HN20tI1ziNtpDhWs6msC+BBnDVn9fxNr6c RmyWeYYWbslBUzTT1SrWYXWk3VdACHhWupAYndcj0nq2vJLFRZQYP3RxyTsTGZTxKpUB zg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n3k0154bs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Jan 2023 16:27:59 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30KGNJar027896; Fri, 20 Jan 2023 16:27:59 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2105.outbound.protection.outlook.com [104.47.70.105]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n6qud91fg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Jan 2023 16:27:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M2kCteIhm/+5Y7z72WFN4NaENkG0pxKHdemTWVTpYgWQ0UhpLZ1Riajv1NXYtjebQ7fc2+r2eaeRJqC9IJnFugioWLn29urH6PfiEigei5q0RVUyop6qaG4RImz+w9/lj5nZCPrhwjQO6Yvr9bXsQMuvSESMQr9EncFvfI1c3EuLBHLkTUWjQ55bdARjHR+/3DQGnWDnoecCJFPcsdqqmt5dppjs+3E6oI7ENDIPflHVqWgHfQxMPEizybkAi1tE1B6UUoxpJNPDHBX+DPd0WcWc2J8cSK3WfekChM3C/otSs+w57bysx5TQiu7DjVpV94vkkDdowiZ1frMcPo+eRA== 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=xC3mu4AKsppqbyDSCw58mvfzh8IAlVWOVoZ5aweJCiA=; b=nCee1KXpLIolb4WsqLwCHkBppctLy0o4EqFsQDtQGVPK7BLn5j8Zzbp7eIDR2rrHEIn/vspslGeyKu/73CaGe3a50bLGtCyHMDdoPrM0cXV2e9wUTZh4g8F24zCY0BUe6ObDZkEAcRSb1ve6+0Paot0NZ4WvySoLPfCsSe+uPj5UN9B/vS+bYObUmQxtXK7gHO/sJMBJc0hjXElGbMHu8MS1CGVG6mPlftlMS7bKuOnxMgIDEEKdlDLSSQNbAEsDK9h/E7bSh/5KgWHPTOEBCB+f1lZzL+Wkigc6KOZIa29yy82DqgfWNjKoL6X946WWCf6oYCa+KsdA9KGN1IN1PQ== 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=xC3mu4AKsppqbyDSCw58mvfzh8IAlVWOVoZ5aweJCiA=; b=HhDZiEVDo3b8n5A9nWY4n7EpdK5HmUiOBSCAYdUmDYOsoqvD+JI9QLepugS8bWAoiSgugYFucBSyGx2WL4PJ+T+3s8wm0smIR7CB+OFnmefT8Pv13wP7NJX/chjxMOlZcC5d03JAyBV4mPeonvP6vaFWVQPqDw5BG96YXjXCVYo= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SN7PR10MB6619.namprd10.prod.outlook.com (2603:10b6:806:2ae::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.7; Fri, 20 Jan 2023 16:27:56 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::7306:828b:8091:9674]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::7306:828b:8091:9674%5]) with mapi id 15.20.6043.005; Fri, 20 Jan 2023 16:27:56 +0000 From: "Liam R. Howlett" <Liam.Howlett@oracle.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>, maple-tree@lists.infradead.org Cc: "Liam R. Howlett" <Liam.Howlett@Oracle.com>, "Liam R . Howlett" <Liam.Howlett@oracle.com> Subject: [PATCH v4 18/49] mlock: Convert mlock to vma iterator Date: Fri, 20 Jan 2023 11:26:19 -0500 Message-Id: <20230120162650.984577-19-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230120162650.984577-1-Liam.Howlett@oracle.com> References: <20230120162650.984577-1-Liam.Howlett@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: YT4PR01CA0055.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:111::18) To SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR10MB3022:EE_|SN7PR10MB6619:EE_ X-MS-Office365-Filtering-Correlation-Id: ceb355af-a16a-4163-4b13-08dafb0349b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6ObCuBKlSkW+zFiCh80A7BZfHeFHIFFzRdOT/qXg+2oAi5CZBmnjQX8SV/jOxbZicyBkOrAGc9trIHvxwrdOJe8zcCjCzJfHN95axqvSj+e8waNRYWnOSUoUFNsAmIEoXMzBzLwcAf6GK0XAbozlFivH1NBE4XEGXtX2aszeVlAc0Qt4EtiBK9dZG+w8HqU3fdytLNulaznK2bmBBm7l0OY6Of6PDjpJnlHBSobdmIQrgL+OrgwnzcklIjpttftXJ8wOPaTr7nIYWPnpLBUtqSojpwX3GLHtBWSYo4wwGzrAWMXhcGbEd4eqv7K0iqdskzzv/OksBtLY/bP9iBCEWqtirzSkCfJl1bvWk8S37DavsknHi3Ik1JolmLg/vnP/s3p/IDc5U2c0iyYxB72wYdM4G6n33MgP2PysW0mm0F1NBQnrFB7OWzgYoLiho0PZSWMH/fxARBMR0UoR1A02F9tXv9OSD+g+sDVAwArvFJ/Ez6xl/yUpoomC5pIbv9BYdSqrdbsuD4HLTy0NA6c3kQbsqqj60gV8xQf8dyUKnAZ5TujaU5rxUYvlorhaKI7WGfRVdpm0/dUFOicOlJVVIBVf8ZsZJ/rIb+hGegFCkRo6wVIrYu7HIVC0hilYDTpTcrc6l9xv4SgVA68PHQ8IJA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(136003)(39860400002)(396003)(366004)(376002)(346002)(451199015)(83380400001)(54906003)(86362001)(5660300002)(6486002)(2616005)(38100700002)(8936002)(478600001)(6512007)(41300700001)(2906002)(107886003)(6666004)(4326008)(8676002)(66556008)(186003)(26005)(316002)(36756003)(1076003)(66476007)(6506007)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2WpRS1GxRYpeeRkj4PrKU3kehHlF4dUO90U2QLWN+42p9IEZgnK4G0lOam95fPh4Imcc1o1ldavUer9xA/Oia0r6OYmAQGzR8NGRRDODw8CKuyNvjKCUsRJlmCLYdDGBNilfnBsZIFOwX7WkRwgo1JwrBgPKHn6diNCsGxYPFWvVnBRNO81Tn4zofBCmMUCDZvrjSf5/f81HO6riWTB0AaPEZao6CMtHJB1NOMROg4jyWM7X9OWRXpiFM6XEx0qfwQWnyFhKw31ESfJWK/suzBYBupYDHuhjDTn5wT6VMaVCCailnILko6YrYMWSVUS/l8meN52sLRJbJXDqyXbvAulcy4wjIxvxT0fkBYViXTVpPxwDQNzp9jijlaibVMfRNj6/ENm1alLoC2umIV3WeUOGmD/4twu22V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iq8xUOJVCurMuTafFG7sVzefU4g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ceb355af-a16a-4163-4b13-08dafb0349b4 X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2023 16:27:56.8091 (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: QxLLRqq4CbgaNF63ZBlnblsKN1iCqZ9fg0RBAZNhKbtTtpVIztv1z35qk0dkqTocMGqEgUAsz178+9SxbFFNmA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB6619 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-20_09,2023-01-20_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301200157 X-Proofpoint-GUID: I_K-UACvcYwpXhSPkTb2g6hJmAW659mI X-Proofpoint-ORIG-GUID: I_K-UACvcYwpXhSPkTb2g6hJmAW659mI 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755572030733411233?= X-GMAIL-MSGID: =?utf-8?q?1755572030733411233?= |
Series |
VMA tree type safety and remove __vma_adjust()
|
|
Commit Message
Liam R. Howlett
Jan. 20, 2023, 4:26 p.m. UTC
From: "Liam R. Howlett" <Liam.Howlett@Oracle.com> Use the vma iterator so that the iterator can be invalidated or updated to avoid each caller doing so. Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> --- mm/mlock.c | 57 +++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 29 deletions(-)
Comments
On 20/01/2023 16:26, Liam R. Howlett wrote: > From: "Liam R. Howlett" <Liam.Howlett@Oracle.com> > > Use the vma iterator so that the iterator can be invalidated or updated > to avoid each caller doing so. Hi, I've bisected 2 mm selftest regressions back to this patch, so hoping someone can help debug and fix? The failures are reproducible on x86_64 and arm64. mlock-random-test: $ ./run_kselftest.sh -t mm:mlock-random-test TAP version 13 1..1 # selftests: mm: mlock-random-test mlock() failure at |0xaaaaaaab52d0(131072)| mlock:|0xaaaaaaacc65d(26551)| not ok 1 selftests: mm: mlock-random-test # exit=255 This mallocs a buffer then loops 100 times, trying to mlock random parts of it. After this patch, the test fails after a variable number of iterations; mlock() returns ENOMEM. If I explicitly munlock at the end of each loop, it works. mlock2-tests: $ ./run_kselftest.sh -t mm:mlock2-tests TAP version 13 1..1 # selftests: mm: mlock2-tests munlock(): Cannot allocate memory munlock(): Cannot allocate memory not ok 1 selftests: mm: mlock2-tests # exit=2 Here, a 3 page buffer is mlock2()ed, then the middle page is munlocked. Finally the whole 3 page range is munlocked, and after this patch it fails with ENOMEM. If I modify the test to split the final munlock into 2, one for the first page and one for the last, the test passes. Immediately prior to this patch (2286a6914c77 "mm: change mprotect_fixup to vma iterator"), both tests pass. From a quick scan of the man page, I don't think it explicitly says that its ok to call mlock/munlock on already locked/unlocked pages, but it's certainly a change of behavior and the tests notice, so I'm guessing this wasn't intentional? I'm not familiar with this code so it's not obvious to me exactly what the problem is, but I'm hoping someone can help debug? Thanks, Ryan > > Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> > --- > mm/mlock.c | 57 +++++++++++++++++++++++++++--------------------------- > 1 file changed, 28 insertions(+), 29 deletions(-) > > diff --git a/mm/mlock.c b/mm/mlock.c > index b680f11879c3..0d09b9070071 100644 > --- a/mm/mlock.c > +++ b/mm/mlock.c > @@ -401,8 +401,9 @@ static void mlock_vma_pages_range(struct vm_area_struct *vma, > * > * For vmas that pass the filters, merge/split as appropriate. > */ > -static int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev, > - unsigned long start, unsigned long end, vm_flags_t newflags) > +static int mlock_fixup(struct vma_iterator *vmi, struct vm_area_struct *vma, > + struct vm_area_struct **prev, unsigned long start, > + unsigned long end, vm_flags_t newflags) > { > struct mm_struct *mm = vma->vm_mm; > pgoff_t pgoff; > @@ -417,22 +418,22 @@ static int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev, > goto out; > > pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT); > - *prev = vma_merge(mm, *prev, start, end, newflags, vma->anon_vma, > - vma->vm_file, pgoff, vma_policy(vma), > - vma->vm_userfaultfd_ctx, anon_vma_name(vma)); > + *prev = vmi_vma_merge(vmi, mm, *prev, start, end, newflags, > + vma->anon_vma, vma->vm_file, pgoff, vma_policy(vma), > + vma->vm_userfaultfd_ctx, anon_vma_name(vma)); > if (*prev) { > vma = *prev; > goto success; > } > > if (start != vma->vm_start) { > - ret = split_vma(mm, vma, start, 1); > + ret = vmi_split_vma(vmi, mm, vma, start, 1); > if (ret) > goto out; > } > > if (end != vma->vm_end) { > - ret = split_vma(mm, vma, end, 0); > + ret = vmi_split_vma(vmi, mm, vma, end, 0); > if (ret) > goto out; > } > @@ -471,7 +472,7 @@ static int apply_vma_lock_flags(unsigned long start, size_t len, > unsigned long nstart, end, tmp; > struct vm_area_struct *vma, *prev; > int error; > - MA_STATE(mas, ¤t->mm->mm_mt, start, start); > + VMA_ITERATOR(vmi, current->mm, start); > > VM_BUG_ON(offset_in_page(start)); > VM_BUG_ON(len != PAGE_ALIGN(len)); > @@ -480,39 +481,37 @@ static int apply_vma_lock_flags(unsigned long start, size_t len, > return -EINVAL; > if (end == start) > return 0; > - vma = mas_walk(&mas); > + vma = vma_iter_load(&vmi); > if (!vma) > return -ENOMEM; > > + prev = vma_prev(&vmi); > if (start > vma->vm_start) > prev = vma; > - else > - prev = mas_prev(&mas, 0); > > - for (nstart = start ; ; ) { > - vm_flags_t newflags = vma->vm_flags & VM_LOCKED_CLEAR_MASK; > + nstart = start; > + tmp = vma->vm_start; > + for_each_vma_range(vmi, vma, end) { > + vm_flags_t newflags; > > - newflags |= flags; > + if (vma->vm_start != tmp) > + return -ENOMEM; > > + newflags = vma->vm_flags & VM_LOCKED_CLEAR_MASK; > + newflags |= flags; > /* Here we know that vma->vm_start <= nstart < vma->vm_end. */ > tmp = vma->vm_end; > if (tmp > end) > tmp = end; > - error = mlock_fixup(vma, &prev, nstart, tmp, newflags); > + error = mlock_fixup(&vmi, vma, &prev, nstart, tmp, newflags); > if (error) > break; > nstart = tmp; > - if (nstart < prev->vm_end) > - nstart = prev->vm_end; > - if (nstart >= end) > - break; > - > - vma = find_vma(prev->vm_mm, prev->vm_end); > - if (!vma || vma->vm_start != nstart) { > - error = -ENOMEM; > - break; > - } > } > + > + if (vma_iter_end(&vmi) < end) > + return -ENOMEM; > + > return error; > } > > @@ -658,7 +657,7 @@ SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len) > */ > static int apply_mlockall_flags(int flags) > { > - MA_STATE(mas, ¤t->mm->mm_mt, 0, 0); > + VMA_ITERATOR(vmi, current->mm, 0); > struct vm_area_struct *vma, *prev = NULL; > vm_flags_t to_add = 0; > > @@ -679,15 +678,15 @@ static int apply_mlockall_flags(int flags) > to_add |= VM_LOCKONFAULT; > } > > - mas_for_each(&mas, vma, ULONG_MAX) { > + for_each_vma(vmi, vma) { > vm_flags_t newflags; > > newflags = vma->vm_flags & VM_LOCKED_CLEAR_MASK; > newflags |= to_add; > > /* Ignore errors */ > - mlock_fixup(vma, &prev, vma->vm_start, vma->vm_end, newflags); > - mas_pause(&mas); > + mlock_fixup(&vmi, vma, &prev, vma->vm_start, vma->vm_end, > + newflags); > cond_resched(); > } > out:
* Ryan Roberts <ryan.roberts@arm.com> [230711 10:09]: > On 20/01/2023 16:26, Liam R. Howlett wrote: > > From: "Liam R. Howlett" <Liam.Howlett@Oracle.com> > > > > Use the vma iterator so that the iterator can be invalidated or updated > > to avoid each caller doing so. > > Hi, Hello! > > I've bisected 2 mm selftest regressions back to this patch, so hoping someone can help debug and fix? The failures are reproducible on x86_64 and arm64. Thanks! That is a big help. Where did you start your bisection? I assume 6.4? > > > mlock-random-test: > > $ ./run_kselftest.sh -t mm:mlock-random-test > TAP version 13 > 1..1 > # selftests: mm: mlock-random-test > mlock() failure at |0xaaaaaaab52d0(131072)| mlock:|0xaaaaaaacc65d(26551)| > not ok 1 selftests: mm: mlock-random-test # exit=255 > > This mallocs a buffer then loops 100 times, trying to mlock random parts of it. After this patch, the test fails after a variable number of iterations; mlock() returns ENOMEM. If I explicitly munlock at the end of each loop, it works. > > > mlock2-tests: > > $ ./run_kselftest.sh -t mm:mlock2-tests > TAP version 13 > 1..1 > # selftests: mm: mlock2-tests > munlock(): Cannot allocate memory > munlock(): Cannot allocate memory > not ok 1 selftests: mm: mlock2-tests # exit=2 > > Here, a 3 page buffer is mlock2()ed, then the middle page is munlocked. Finally the whole 3 page range is munlocked, and after this patch it fails with ENOMEM. If I modify the test to split the final munlock into 2, one for the first page and one for the last, the test passes. > > > Immediately prior to this patch (2286a6914c77 "mm: change mprotect_fixup to vma iterator"), both tests pass. > > From a quick scan of the man page, I don't think it explicitly says that its ok to call mlock/munlock on already locked/unlocked pages, but it's certainly a change of behavior and the tests notice, so I'm guessing this wasn't intentional? > > I'm not familiar with this code so it's not obvious to me exactly what the problem is, but I'm hoping someone can help debug? I think I see the issue and I'm working on a fix. I appreciate the analysis and report, it really helps narrow things down. Regards, Liam
On 11/07/2023 16:27, Liam R. Howlett wrote: > * Ryan Roberts <ryan.roberts@arm.com> [230711 10:09]: >> On 20/01/2023 16:26, Liam R. Howlett wrote: >>> From: "Liam R. Howlett" <Liam.Howlett@Oracle.com> >>> >>> Use the vma iterator so that the iterator can be invalidated or updated >>> to avoid each caller doing so. >> >> Hi, > > > Hello! > >> >> I've bisected 2 mm selftest regressions back to this patch, so hoping someone can help debug and fix? The failures are reproducible on x86_64 and arm64. > > Thanks! That is a big help. Where did you start your bisection? I > assume 6.4? Yes, I'm working to get all the mm selftests running (and ideally passing!) on arm64. I working on v6.4 and it was broken there. I went arbitrarily back to v5.10 and it was working there, so bisected between them. > >> >> >> mlock-random-test: >> >> $ ./run_kselftest.sh -t mm:mlock-random-test >> TAP version 13 >> 1..1 >> # selftests: mm: mlock-random-test >> mlock() failure at |0xaaaaaaab52d0(131072)| mlock:|0xaaaaaaacc65d(26551)| >> not ok 1 selftests: mm: mlock-random-test # exit=255 >> >> This mallocs a buffer then loops 100 times, trying to mlock random parts of it. After this patch, the test fails after a variable number of iterations; mlock() returns ENOMEM. If I explicitly munlock at the end of each loop, it works. >> >> >> mlock2-tests: >> >> $ ./run_kselftest.sh -t mm:mlock2-tests >> TAP version 13 >> 1..1 >> # selftests: mm: mlock2-tests >> munlock(): Cannot allocate memory >> munlock(): Cannot allocate memory >> not ok 1 selftests: mm: mlock2-tests # exit=2 >> >> Here, a 3 page buffer is mlock2()ed, then the middle page is munlocked. Finally the whole 3 page range is munlocked, and after this patch it fails with ENOMEM. If I modify the test to split the final munlock into 2, one for the first page and one for the last, the test passes. >> >> >> Immediately prior to this patch (2286a6914c77 "mm: change mprotect_fixup to vma iterator"), both tests pass. >> >> From a quick scan of the man page, I don't think it explicitly says that its ok to call mlock/munlock on already locked/unlocked pages, but it's certainly a change of behavior and the tests notice, so I'm guessing this wasn't intentional? >> >> I'm not familiar with this code so it's not obvious to me exactly what the problem is, but I'm hoping someone can help debug? > > I think I see the issue and I'm working on a fix. I appreciate the > analysis and report, it really helps narrow things down. You're welcome! > > Regards, > Liam
* Ryan Roberts <ryan.roberts@arm.com> [230711 11:30]: > On 11/07/2023 16:27, Liam R. Howlett wrote: > > * Ryan Roberts <ryan.roberts@arm.com> [230711 10:09]: > >> On 20/01/2023 16:26, Liam R. Howlett wrote: > >>> From: "Liam R. Howlett" <Liam.Howlett@Oracle.com> > >>> > >>> Use the vma iterator so that the iterator can be invalidated or updated > >>> to avoid each caller doing so. > >> > >> Hi, > > > > > > Hello! > > > >> > >> I've bisected 2 mm selftest regressions back to this patch, so hoping someone can help debug and fix? The failures are reproducible on x86_64 and arm64. > > > > Thanks! That is a big help. Where did you start your bisection? I > > assume 6.4? > > Yes, I'm working to get all the mm selftests running (and ideally passing!) on > arm64. I working on v6.4 and it was broken there. I went arbitrarily back to > v5.10 and it was working there, so bisected between them. > Annoyingly, this is similar to another bug I had fixed in another iterator across VMAs. It's the same pattern and I did go back to see if I had broken other places but, obviously, I missed this one. It's annoying enough that I'm trying to figure out a better way to do this in general.. A contiguous iterator of sorts. I will add this to my maple tree work list [1]. [1] http://lists.infradead.org/pipermail/maple-tree/2023-July/002683.html Thanks, Liam
diff --git a/mm/mlock.c b/mm/mlock.c index b680f11879c3..0d09b9070071 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -401,8 +401,9 @@ static void mlock_vma_pages_range(struct vm_area_struct *vma, * * For vmas that pass the filters, merge/split as appropriate. */ -static int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev, - unsigned long start, unsigned long end, vm_flags_t newflags) +static int mlock_fixup(struct vma_iterator *vmi, struct vm_area_struct *vma, + struct vm_area_struct **prev, unsigned long start, + unsigned long end, vm_flags_t newflags) { struct mm_struct *mm = vma->vm_mm; pgoff_t pgoff; @@ -417,22 +418,22 @@ static int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev, goto out; pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT); - *prev = vma_merge(mm, *prev, start, end, newflags, vma->anon_vma, - vma->vm_file, pgoff, vma_policy(vma), - vma->vm_userfaultfd_ctx, anon_vma_name(vma)); + *prev = vmi_vma_merge(vmi, mm, *prev, start, end, newflags, + vma->anon_vma, vma->vm_file, pgoff, vma_policy(vma), + vma->vm_userfaultfd_ctx, anon_vma_name(vma)); if (*prev) { vma = *prev; goto success; } if (start != vma->vm_start) { - ret = split_vma(mm, vma, start, 1); + ret = vmi_split_vma(vmi, mm, vma, start, 1); if (ret) goto out; } if (end != vma->vm_end) { - ret = split_vma(mm, vma, end, 0); + ret = vmi_split_vma(vmi, mm, vma, end, 0); if (ret) goto out; } @@ -471,7 +472,7 @@ static int apply_vma_lock_flags(unsigned long start, size_t len, unsigned long nstart, end, tmp; struct vm_area_struct *vma, *prev; int error; - MA_STATE(mas, ¤t->mm->mm_mt, start, start); + VMA_ITERATOR(vmi, current->mm, start); VM_BUG_ON(offset_in_page(start)); VM_BUG_ON(len != PAGE_ALIGN(len)); @@ -480,39 +481,37 @@ static int apply_vma_lock_flags(unsigned long start, size_t len, return -EINVAL; if (end == start) return 0; - vma = mas_walk(&mas); + vma = vma_iter_load(&vmi); if (!vma) return -ENOMEM; + prev = vma_prev(&vmi); if (start > vma->vm_start) prev = vma; - else - prev = mas_prev(&mas, 0); - for (nstart = start ; ; ) { - vm_flags_t newflags = vma->vm_flags & VM_LOCKED_CLEAR_MASK; + nstart = start; + tmp = vma->vm_start; + for_each_vma_range(vmi, vma, end) { + vm_flags_t newflags; - newflags |= flags; + if (vma->vm_start != tmp) + return -ENOMEM; + newflags = vma->vm_flags & VM_LOCKED_CLEAR_MASK; + newflags |= flags; /* Here we know that vma->vm_start <= nstart < vma->vm_end. */ tmp = vma->vm_end; if (tmp > end) tmp = end; - error = mlock_fixup(vma, &prev, nstart, tmp, newflags); + error = mlock_fixup(&vmi, vma, &prev, nstart, tmp, newflags); if (error) break; nstart = tmp; - if (nstart < prev->vm_end) - nstart = prev->vm_end; - if (nstart >= end) - break; - - vma = find_vma(prev->vm_mm, prev->vm_end); - if (!vma || vma->vm_start != nstart) { - error = -ENOMEM; - break; - } } + + if (vma_iter_end(&vmi) < end) + return -ENOMEM; + return error; } @@ -658,7 +657,7 @@ SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len) */ static int apply_mlockall_flags(int flags) { - MA_STATE(mas, ¤t->mm->mm_mt, 0, 0); + VMA_ITERATOR(vmi, current->mm, 0); struct vm_area_struct *vma, *prev = NULL; vm_flags_t to_add = 0; @@ -679,15 +678,15 @@ static int apply_mlockall_flags(int flags) to_add |= VM_LOCKONFAULT; } - mas_for_each(&mas, vma, ULONG_MAX) { + for_each_vma(vmi, vma) { vm_flags_t newflags; newflags = vma->vm_flags & VM_LOCKED_CLEAR_MASK; newflags |= to_add; /* Ignore errors */ - mlock_fixup(vma, &prev, vma->vm_start, vma->vm_end, newflags); - mas_pause(&mas); + mlock_fixup(&vmi, vma, &prev, vma->vm_start, vma->vm_end, + newflags); cond_resched(); } out: