From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6889382377 for ; Fri, 10 Jul 2026 19:13:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783710786; cv=none; b=uEm8Qq1VLFXpkuaTFojzHj+3fgrT8UFH/bL/6Uu6wtBYrD041aOFm03S27JePPwNEbXOIP5vpluB6Hx5IJZ3VO2aSRburPT0HXtvyaUdoIx2qPpm6/PDcMQFxUsDx3zXU8ETvB5PTctXxW6I/cO/b3V+xodBwQQ76Hh+aojara4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783710786; c=relaxed/simple; bh=mbUpbN9JA5TocILiu7DT262VDuT+uIcfX8rdIywuDIw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dpyFrEu1iZ1FXvNJQbGVtxAMLnWivFJF8R13szdiRyzLDwFQ3M2x6H+qIm1ZXGSEmMmTFIzwI7cCQ6v3WGV0bdilmwTIcBmnV1OZr0/HhTOId81u3SkI9xN5EIxJb6GWPKBLHVE8PPgDa6P/RW2TH6Nti9fu2M0fnLOkt4cy+zE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=mUx1VT0P; arc=none smtp.client-ip=209.85.219.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="mUx1VT0P" Received: by mail-qv1-f41.google.com with SMTP id 6a1803df08f44-8efb708b1a0so11491416d6.3 for ; Fri, 10 Jul 2026 12:13:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1783710783; x=1784315583; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=Zl1BBUQ1SVF8WlDcAjuqmqY9e/JVxV3t5chHRhyKtnA=; b=mUx1VT0PIOg/xwhlOTlIJEriNCZxkdBJZVjc9C5uxphAkNM8EEs2imYn5i1hgOnvX4 xwXlqQICD+cOrqA5hIZZbrZaES3jwUi5ChfT30etJK+PoH8/mA2cDMsBTFHDmhUP0FPt z/CMZnu4OqUu+aiDWu+sem1azbKqRtlmsXojxJbFE0lsZeP1Hr3d6/Pr6CVkhwBKqRN5 ogd26C6iV69u+TuQzA1Fh2frC1svhr669/Z61r8cEK1brwL4XRueu3Ptbu8FgsDJfzXO 2DGBKApV0OVyOjSpaaYZ0h/o1TqS/+tA7LhRSCDGyE0WzhLeouwLG22YQFz+ZET9fA/U n8cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783710783; x=1784315583; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Zl1BBUQ1SVF8WlDcAjuqmqY9e/JVxV3t5chHRhyKtnA=; b=lyj3+4V0g5/u/ebcnds13DsllQE2ZnF4Y3aKPLeOshiH/gO+dLU1ESZzk4HG5/gMnC hgDoQ3/PzpD7C7a3kTneQi2MHrf0ImI4JQxp5d02b+irEP4MslyVHay2fNzu7nWxlDZG ZSyjNR+bsgk6d/z+DQxmVVb7ZmYCpUWeH0iEL7/HfLQMAfMPOu6h4sCdkZWZfXE0WvN5 nVXJdtbuoJHWt7R1CLhkn56wrqfNHhucsbocBnyVpJbEPc+4A/GgJkvXoeWObu2QJURr wo/BRXYX1n73+JLXjoHyGKVTv47I6Zhm+iXquxukXtbuIlEcSzYk9odMD0yCDLZMv8Yq paEg== X-Forwarded-Encrypted: i=1; AHgh+RqgxnKLdhVHdPLEpzKT6l1NnCwfx2xbaaiYNsrBN1JtsHTXjgkFZUt+TPWTXfkI21ehYSE=@vger.kernel.org X-Gm-Message-State: AOJu0Yy6V1JciUTxcGCVQ4ic9AUHIE3YhM+wN7a7FtPCHJaEWLvYecqs XgmyGHQR1thG5RBbUvaMhNUYUwdMgrD9JdyuXmgBhfqAkZuPtsQTvZDae22XM7Mr9Q8= X-Gm-Gg: AfdE7cmk4/bwNc4+SbF5Y5WGPU9564erwmBjr5Mr/smZk6G7VmJek9nTNbSIgbvBRyr 614az+e79njF6qAfhEsLngXDnQF2hHOju8KwYduLRgHLAz/WvdeQcqqe+y9w/Q0Se3WN6cLeuY3 EJraxgYor8uxYuI0L+qH522rV1pm+dOmnO5HtOBf9kVeMLtQL3l6N1m2uPApzUiHX7nUg5/4yle HMWBM+XY6CHlafaHhAencq6pLNXgnUMLJFy8VG+PkBNYCRCM+arJ06DVZuNNElUzbZczEsCjvse ivmh973wb49j91tNo3Ps/nq9ucBfW0ippKCzrYVHzy0xUCiS/a25FpF6omK7GXPW40EPXtMRnCi TRE8AIfSP7bi9HWAElKP72GFjnFbzuYAHhI6+zx3HYG2l5AG8ijD0jA6ZC8aBUGDZwGUi5+nkvX jHnctyz7MXcXrbuaLmtxUnTq8Wtp+HWqs2tzj7Whch9ODzo5RfABghg7fVBq7tVLXbdTgn X-Received: by 2002:a05:6214:450c:b0:8f0:9d9c:52c2 with SMTP id 6a1803df08f44-903fe450e5fmr5228126d6.5.1783710782628; Fri, 10 Jul 2026 12:13:02 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-173-79-60-52.washdc.fios.verizon.net. [173.79.60.52]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8ffd87c9128sm47321526d6.45.2026.07.10.12.13.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 12:13:02 -0700 (PDT) Date: Fri, 10 Jul 2026 15:12:57 -0400 From: Gregory Price To: Lorenzo Stoakes Cc: Andrew Morton , Russell King , Dinh Nguyen , Simon Schuster , "James E . J . Bottomley" , Helge Deller , Jarkko Sakkinen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Ian Abbott , H Hartley Sweeten , Lucas Stach , David Airlie , Simona Vetter , Patrik Jakobsson , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Clark , Dmitry Baryshkov , Tomi Valkeinen , Thierry Reding , Mikko Perttunen , Jonathan Hunter , Christian Koenig , Huang Rui , Ankit Agrawal , Alex Williamson , Alexander Viro , Christian Brauner , Dan Williams , Muchun Song , Oscar Salvador , David Hildenbrand , Suren Baghdasaryan , "Liam R . Howlett" , Matthew Wilcox , Marek Szyprowski , Peter Zijlstra , Arnaldo Carvalho de Melo , Namhyung Kim , Masami Hiramatsu , Oleg Nesterov , Steven Rostedt , SeongJae Park , Miaohe Lin , Hugh Dickins , Mike Rapoport , Kees Cook , Paolo Bonzini , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-parisc@vger.kernel.org, linux-sgx@vger.kernel.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-tegra@vger.kernel.org, kvm@vger.kernel.org, linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev, linux-mm@kvack.org, iommu@lists.linux.dev, linux-perf-users@vger.kernel.org, linux-trace-kernel@vger.kernel.org, kasan-dev@googlegroups.com, damon@lists.linux.dev, Pedro Falcato , Rik van Riel , Harry Yoo , Jann Horn Subject: Re: [PATCH 25/30] mm/vma: update vmg_adjust_set_range() to offset pgoff instead Message-ID: References: <910f7b5be78232304dc7ca01cd57c6f5ca8f3d13.1782735110.git.ljs@kernel.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <910f7b5be78232304dc7ca01cd57c6f5ca8f3d13.1782735110.git.ljs@kernel.org> On Mon, Jun 29, 2026 at 01:23:36PM +0100, Lorenzo Stoakes wrote: > We are calculating the pgoff as an offset, since we have vma_add_pgoff() > and vma_sub_pgoff() available, just offset this value directly and use > __vma_set_range() for vma->vm_[start, end] values. > > We take care to update the range before offsetting the page offset, so the > adjusted VMA's vm_start and vm_pgoff are mutually consistent at the point > the page offset helpers operate - this matters once vma_set_pgoff() comes > to assert invariants which relate the two. > Given the prior code just did it in 3 lines of code with no special dance, there's a presumption here that this is done in a critical section and no external actor can see the inconsistent state? (i.e. range is updated but offset is not) Just think about this from a bisection/debugging standpoint. > Doing so lays the foundation for future work which allows for use of > virtual page offsets for MAP_PRIVATE-file backed mappings. > > No functional change intended. > > Signed-off-by: Lorenzo Stoakes Reviewed-by: Gregory Price