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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 D1BC8C5B56A for ; Tue, 11 Aug 2026 16:51:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 689C010EB39; Tue, 11 Aug 2026 16:51:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="Zu6P4EWl"; dkim-atps=neutral Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 81DC510EB39; Tue, 11 Aug 2026 16:51:49 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 3B16343C0F; Tue, 11 Aug 2026 16:51:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 694BD1F000E9; Tue, 11 Aug 2026 16:51:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786467109; bh=nUtXloIWo+60BaXIYhpidIQX8u9D+3kedoVN7C9D9/g=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Zu6P4EWld4gpzY1R8hq3ER5DyVSS8EQG3tj3hB0FUUqztpnB1xSYcKl3Q43tc8cmj UUsHVaeqqzm48VuQVJJx2EmW7mni8RQ6I1+levHRzt5ChDbHMTxJyaxCh3f6iBS0/C 55H0zKXQaRRXxQd/+WCqvaxpLr5pPGlTLRkmGM/8141rUWlck+hHndDPdyOG2aaDBw gO3sp1uV5pzP/Ne9Y0kFwRhkfkxbs6cWxO90fh/uBbI39rSVBYq65rSukH7lNfLsuz C2uETEK6ptuNat6DVNihDE0Y6C1cj1icY2cXtTTklAMhkklLMENnIaGg5NMBUxP04U D1oeyGwJyciyA== Date: Tue, 11 Aug 2026 17:51:33 +0100 From: "Lorenzo Stoakes (ARM)" To: "David Hildenbrand (Arm)" Cc: Andrew Morton , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jann Horn , Pedro Falcato , "Matthew Wilcox (Oracle)" , Jan Kara , Miaohe Lin , Naoya Horiguchi , Rik van Riel , Harry Yoo , Lance Yang , Kees Cook , Zi Yan , Baolin Wang , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Usama Arif , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , Peter Xu , Xu Xin , Chengming Zhou , Arnd Bergmann , Greg Kroah-Hartman , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Sven Schnelle , Alex Deucher , Christian =?utf-8?B?S8O2bmln?= , David Airlie , Simona Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Boris Brezillon , Steven Price , Liviu Dudau , Huang Rui , Matthew Auld , Thomas =?utf-8?Q?Hellstr=C3=B6m?= , Rodrigo Vivi , Masami Hiramatsu , Oleg Nesterov , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Jason Gunthorpe , John Hubbard , Muchun Song , Oscar Salvador , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Youngjun Park , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org, kvm@vger.kernel.org, linux-s390@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-perf-users@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: Re: [PATCH v4 07/20] mm/vma: fix self-merge check in copy_vma() Message-ID: References: <20260806-b4-scalable-cow-virt-pgoff-v4-0-ab318a350404@kernel.org> <20260806-b4-scalable-cow-virt-pgoff-v4-7-ab318a350404@kernel.org> <3a0a9aaf-20f5-4f92-b848-00ab702e8fe2@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3a0a9aaf-20f5-4f92-b848-00ab702e8fe2@kernel.org> X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" On Tue, Aug 11, 2026 at 06:44:01PM +0200, David Hildenbrand (Arm) wrote: > > > > Since copy_vma_and_data() which calls copy_vma() intends to reference the > > old VMA after the merge, it must have this pointer updated. > > > > This kind of self-merge is not possible with a succeeding merge, as the > > merge always prefers to expand the preceding VMA if possible. > > > > copy_vma() accounts for this by explicitly checking to see if a self-merge > > occurred and updating the vmap pointer if so. However it incorrect did so > > even for a subsequent merge (this is simply a noop so it had no impact). > > Took me longer than it should to find out that this is no real fix ;) > > > > > So change this to only check for the case which matters - a backwards > > merge - and rearrange the parameters to make it clearer we're doing that - > > i.e. check new_vma->vm_start < old_vma_start (having already renamed > > vma_start to old_vma_start to make it clear this is the previous VMA). > > > > Also update the existing wall-of-text comment to be a lot clearer. > > > > While we're here, replace the VM_BUG_ON_VMA() with a VM_WARN_ON_ONCE_VMA() > > and update the VMA userland tests accordingly. > > > > No functional change intended. > > > > Signed-off-by: Lorenzo Stoakes (ARM) > > --- > I skimmed over it, looks correct, but the merging stuff is way over my head to > confidentially give a RB tag her :) Well that's what A-b is for ;) > > -- > Cheers, > > David -- Cheers, Lorenzo