From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) (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 A1762367B61 for ; Thu, 9 Jul 2026 15:18:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783610331; cv=none; b=X7WKd8u3PhJB8Zlh96i+C5DI9OP16eTYgTk8NdoZESjcmCsT031lDeFmcdtlf7e3kO99vitzR0BlWxhaqjiEdIAJJffl+c573pHN3jfTbDWPTkKu09dBNNIXSaSadZdpX0jNLYZGLfk4b9K1qln3Pjg079bAVUONS00dy1qVU20= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783610331; c=relaxed/simple; bh=EmhDmZEzfDqtz+/wM5OYtSnBNKhNR5z6WmgKAnKqYZg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=b6IRr/hWaJZww+koLV4wsba0EcYhIoGXliS7LHHfdt2Xql6/VHGqPxC2ZkQ6Xq3xQRIxNjCi0ngb1fCcMB08phLiXfTrJ/2Qt8f59T19jRSyjXvMbTkrzdBPxuZxKdj2gS8mbg/yO9Tvpm+ogZeOxyelSslOo1XO4YJDp+711Ak= 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=XYuSc5IC; arc=none smtp.client-ip=209.85.160.182 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="XYuSc5IC" Received: by mail-qt1-f182.google.com with SMTP id d75a77b69052e-51c16ac21acso11053931cf.0 for ; Thu, 09 Jul 2026 08:18:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1783610327; x=1784215127; 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=D66HPeIJnm5ZDnK+VorUOpyiniaZPeUCt2fPIKMnyb4=; b=XYuSc5IC+EVJbDWikpVPC9cDKrnWwVwEAM4vxRerghx9T5cLKor0lZn/3xvEy8MYvH P4G8QPzYbfEZ/SuD19iQ/Y1IHWEN8FQYvrl4gGGNvM85yYx5CoTWRnrwozvd8buW/yZu rTLr0Kl5kFm/eeBRVjl2lZuNMDx5WC8PeGDIx78E6vBCLlaGrNT+PUtAJ/u8INBmJnMf RbCmKrzJydlT8MQRk1duN94/X88hvDTJtAhpiVN/Uddledvv9UkLMBn9POBFDX+NJflU wUwaXNQ4tD3o84h7GQtBbwvEsPtUxnWPlr1FHKAANE+13sbK/9le7ZhU64POCONVaFwl Syjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783610327; x=1784215127; 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=D66HPeIJnm5ZDnK+VorUOpyiniaZPeUCt2fPIKMnyb4=; b=nX662XJ5nvKr2WTAhGELccCo8OeJEVHHCUG89QCo7DvcRnOSxgbf0jC5g7B6OGsVTK vtHthvFuy3M5hzhpXHvG4UGtvflxhB3iXSZyL9zAt7i3KBguIUuFiCZxTLYoxmxxuLYc 1QhWEMVhdRcvZi4K7fRfnRF9QN4O2VE+d3WOrscdMXU8PSeVRn6O+O8ZYfk2/lZ4ji6K eaV1ZIpI1hHkuSne2dQNT2WcAkSWbowaF+Nv1XPkBhhZ2p6/UkGuBe1Ji0iijuU84moz 0V8ac9lHy+9R4LQKni00VkU7RZbGIJh9LT/ilBTJFVwyLyE6+MVwNr4cvJPWIiPlxOmg JP4Q== X-Forwarded-Encrypted: i=1; AHgh+RoUWY09XxuPH006ugevjUZja2fg6z2r5g37iMqLJIB8mBo1SArFnHVceFAgIewUUDtIJzl/l0EVAk4=@vger.kernel.org X-Gm-Message-State: AOJu0YybGmwFCjQ/bnoYnOj6ayxjFFqu7pDfeYls8WKdC+suCt1PV4Nb LJwSUIQD7HUVoP6u5JGvejyMjJo4vnJUdyeJoR9TfT7vDW0nrhCk60w4BX5Yrt/tNwQ= X-Gm-Gg: AfdE7clj02JLoOrs0b/86ertlmccU6KIKCC7PaZW3INWHgn948jb99N6/W00A9ka9As LKOC1Kblx/az52j69rXQTz39+MTM028cOSpmykiqA0VcfFtI2AwT2scuzbrL+M8XbKQVlJP5eRC Kd7AWIupRyv9IAHApqMOT6+aTNb2lAfpzT2oyQODLjsnpQdQ0VUJHIhnXq26B9AnDH5prKaSQMO N8EBymL37+1txSP/NxJEnNyb4tu8Xd3TBrkNXTTq4umsk5j1cb3XD5lXNnwNusEKVN5gfvC3QwB aAk2mjMffl/mhUPDetDs4lCAhMDyHY5sUQTc4GIidonsE6HG4TApKksfrApaELL4feSaSOwTPl3 +j7CzoGvK55kv2s13yk0u3fvYgUylqbLeE2NP3nhuBr64nF4i0kpyQOYAtdeYorOxhoaMqbIZwS HSK0roLj9TAETHG7lGVNQ95CTqH8tuxyUA75bs6lnXFQEe/F+muVEtMG0jcEDkFDjz4/OtT1JzM Q9tMRQ= X-Received: by 2002:ac8:5cd4:0:b0:51c:1c2c:a8c9 with SMTP id d75a77b69052e-51c8b3e2e32mr79753441cf.43.1783610327278; Thu, 09 Jul 2026 08:18:47 -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 d75a77b69052e-51c41db4fb5sm158006781cf.25.2026.07.09.08.18.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2026 08:18:45 -0700 (PDT) Date: Thu, 9 Jul 2026 11:18:40 -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 13/30] mm/vma: refactor vmg_adjust_set_range() for clarity Message-ID: References: Precedence: bulk X-Mailing-List: linux-sgx@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: On Mon, Jun 29, 2026 at 01:23:24PM +0100, Lorenzo Stoakes wrote: > Add comments with ASCII diagrams to describe what we're doing, avoid > dubious use of PHYS_PFN(), and use vma_start_pgoff(). > > The most complicated scenario represented here is vmg->__adjust_next_start > - when this is set, vmg->[start, end] actually indicate the range to be > retained, so take special care to describe this accurately. > > No functional change intended. > > Signed-off-by: Lorenzo Stoakes Reviewed-by: Gregory Price > + /* > + * vmg->start vmg->end > + * | | > + * v merge v > + * <-------------> > + * delta > + * <------> > + * |------|----------------| > + * | prev | middle | > + * |------|----------------| > + * ^ > + * | > + * middle->vm_start > + */ Even with these diagrams, it's a bit difficult to understand what the actual intent/result of this chunk is (but that may be a limitation of me not spending enough time reading the surrounding code, not a comment of your work here). ~Gregory > + /* > + * Originally: > + * > + * vmg->start vmg->end > + * | | > + * v merge v > + * <------------> > + * . . > + * merge_existing_range() updates to: > + * . . > + * vmg->start vmg->end . > + * | | . > + * v retain v . > + * <----------> . > + * delta . > + * <-----> . > + * |----------------|------| > + * | middle | next | > + * |----------------|------| > + * ^ > + * | > + * next->vm_start > + */