From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EF648C98324 for ; Fri, 25 Sep 2026 09:35:38 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4hrltd2fVFz2ygX; Fri, 25 Sep 2026 19:35:37 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip="2600:3c0a:e001:78e:0:1991:8:25" ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1790328937; cv=none; b=ZKTUo1aoAb+fvxYhPTRHMe2QGEr6qXLLySXMxlStBCYQPngKBA2CO2BJ56rXJvvky6GpFakQPDTcKMo0J9piHEUxa915iI8VZRi15GyM1dCCWbAayw2KNbVAFZaAHfrXa90r6/LgowsrbA16kUrXus3XYAHTOBkBnzcE9bCH/OxrbtJvder31rWORpfApPkq9lxW6O65PuPWlSoPA1Gxda97F7ZOacBioqb30IHHEK/Yv8GoX6ru8V9atpHIaXdeWXmBzPWglkrLZXT771mvT/UqaUCuoRapYxWBbymavtvvGVlzRMEKXSca3YLecW8ax3XnOnHQJ/MgEIjqHuKlCQ== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1790328937; c=relaxed/relaxed; bh=uLG5lXHaGba/dPImy7unpJ5IThclo3TEAxLWPTrsKfU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SApIADs4De8GRbCJD4QB6kOkztRw7DeMwziJjrl5z7CSSsYQ9Q2out/Osh9NFM2GsE/Lf3FOQtkTBRZ5pntbsNGx3G7xUa4HFhHkob8PvCLnm1nYvLe4sgDIFW2bDCGo23MbCd/SqqkgNJaMuOBt6A6G3EtJjNf7SO2jQxdlFTPowIVBOlv+vEMcJavSGrh0NkFBveQNupQ4K07R6pNOjI5F6LqT4jaQPY2ATwc6zDJ5rT2fdemGHDqO8L4CNnbCF8jHhdXTk05hewxyfH1bYrZPwo1jJh04gpRFmq7xzbfA9xz38BjwZZol9Ak8lNhBWRW3v8V0b/KHbhgCdU3ViQ== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bzZxhyhs; dkim-atps=neutral; spf=pass (client-ip=2600:3c0a:e001:78e:0:1991:8:25; helo=sea.source.kernel.org; envelope-from=ljs@kernel.org; receiver=lists.ozlabs.org) smtp.mailfrom=kernel.org Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bzZxhyhs; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2600:3c0a:e001:78e:0:1991:8:25; helo=sea.source.kernel.org; envelope-from=ljs@kernel.org; receiver=lists.ozlabs.org) Received: from sea.source.kernel.org (sea.source.kernel.org [IPv6:2600:3c0a:e001:78e:0:1991:8:25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4hrltc2zHQz2xCC for ; Fri, 25 Sep 2026 19:35:36 +1000 (AEST) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id F1788417CA; Fri, 25 Sep 2026 09:35:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DC6D1F000FF; Fri, 25 Sep 2026 09:35:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790328932; bh=uLG5lXHaGba/dPImy7unpJ5IThclo3TEAxLWPTrsKfU=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=bzZxhyhsPfPrL97TbhC325gHjRpuHNOnRAtDnIf7+He5gMfkm4PSOaeLWWHbi8c+l 6gLN53Uwdjt1XIK0OfcSHtcQmumMJlRTA69LriLBQLJ0wlctJVs9Bq/WbFIYgezX2S o7HKidp4dQ3owP9NtNKbVP6jhZCshUTUiQ66DK4nhMPv/dIHOX+rBfreTpiYW/Trbr lwzJ176A2TJiIAwDANzHglZssZ2IwPz45AtPMn/Payp0HQBUyL8MtoMoRwY1oA7vIH So1mhkj16h3+GX9qr62k4qaQbTa37MdNPZHhAdlXJfG4rCoV0gvFtIiYsigAgrqycF Yh3V65CGNEVUA== Date: Fri, 25 Sep 2026 10:35:02 +0100 From: "Lorenzo Stoakes (ARM)" To: Zi Yan Cc: Andrew Morton , "Liam R. Howlett" , Vlastimil Babka , Jann Horn , Pedro Falcato , David Hildenbrand , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jonathan Corbet , Greg Kroah-Hartman , Dennis Dalessandro , Jason Gunthorpe , Leon Romanovsky , Paul Moore , Stephen Smalley , Jaroslav Kysela , Takashi Iwai , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , Baolin Wang , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Usama Arif , Kiryl Shutsemau , Doug Gilbert , "James E.J. Bottomley" , "Martin K. Petersen" , Jaya Kumar , Simona Vetter , Helge Deller , Sebastian Reichel , John Hubbard , Peter Xu , Masami Hiramatsu , Oleg Nesterov , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Rik van Riel , Harry Yoo , Juri Lelli , Vincent Guittot , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Will Deacon , "Aneesh Kumar K.V" , Nick Piggin , Arnd Bergmann , Muchun Song , Oscar Salvador , "Matthew Wilcox (Oracle)" , Jan Kara , Marc Zyngier , Oliver Upton , Catalin Marinas , Madhavan Srinivasan , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , "David S. Miller" , Andreas Larsson , Alexander Viro , Christian Brauner , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Youngjun Park , Johannes Weiner , Qi Zheng , Shakeel Butt , Axel Rasmussen , Yuanchu Xie , Wei Xu , Chengming Zhou , Michal Hocko , Miklos Szeredi , Xu Xin , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-usb@vger.kernel.org, linux-rdma@vger.kernel.org, selinux@vger.kernel.org, linux-sound@vger.kernel.org, bpf@vger.kernel.org, linux-scsi@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, fuse-devel@lists.linux.dev Subject: Re: [PATCH v3 24/40] mm/mlock: eliminate weird VMA_IO_BIT abuse and simplify Message-ID: References: <20260917-b4-mmap-prepare-vma-flag-sanify-v3-0-4583d8a23bca@kernel.org> <20260917-b4-mmap-prepare-vma-flag-sanify-v3-24-4583d8a23bca@kernel.org> <93672B94-BB0C-4713-8F8A-3619D81DB7BB@nvidia.com> X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Sep 24, 2026 at 11:50:14AM -0400, Zi Yan wrote: > On 24 Sep 2026, at 6:21, Lorenzo Stoakes (ARM) wrote: > >>> diff --git a/mm/folio.c b/mm/folio.c > >>> index 47a437e0f7fd..35e242b48870 100644 > >>> --- a/mm/folio.c > >>> +++ b/mm/folio.c > >>> @@ -505,7 +505,7 @@ void folio_add_lru_vma(struct folio *folio, struct vm_area_struct *vma) > >>> { > >>> VM_BUG_ON_FOLIO(folio_test_lru(folio), folio); > >>> > >>> - if (unlikely((vma->vm_flags & (VM_LOCKED | VM_SPECIAL)) == VM_LOCKED)) > >>> + if (vma_test(vma, VMA_LOCKED_BIT)) > >> > >> I think it is worth documenting VMA_LOCKONFAULT_BIT alone means mlock in > >> progress, like you did in munlock_vma_folio(). Just to keep the protocol > >> explicit for all the readers. > > > > Well I'm not sure it's necessary here honestly, because this never checked > > VMA_LOCKED_MASK anyway, and VMA_LOCKONFAULT_BIT never made a difference. > > > > So the meaning of VMA_LOCKED_BIT here is strictly 'is it locked' and it's > > correctly handled. > > > > And I fear that it becomes whack-a-mole - the neat thing about this change is > > that you no longer have to special case the stupid VM_SPECIAL thing, and can in > > fact do the 'normal' thing of _just checking_ VMA_LOCKED_BIT :) > > > > So I think it's better not to. > > Your reasoning makes sense to me. Thanks :) > >> Why I am commenting in the middle of the series? Because I am taking > >> a quiz given by LLM based on this series to get myself enough background > >> knowledge to review this series. This mlock part came up at part E > >> and I only have part F left before I can do the full review. :) > > > > Thanks! :) I really appreciate you taking the time to look at this! Sorry it's > > so large. > > Sure. It is great learning material for me. Thank you for the patches. No worries, and sorry for the size of this change...! :) > > > > > I held this series back from last cycle to help with review load, then spent > > some time fixing various AI-discovered things, and all the patches are necessary > > (well for the most part) to get where the series needs to go. > > > > I think the change is worth it though! > > Of course, great to see hacky code being removed by this series. > > For this patch, feel free to add > > Reviewed-by: Zi Yan Thanks :) > > > > Best Regards, > Yan, Zi -- Cheers, Lorenzo