On Thu, Jul 09, 2026 at 11:18:40AM -0400, Gregory Price wrote:
On Mon, Jun 29, 2026 at 01:23:24PM +0100, Lorenzo Stoakes wrote:
quoted
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 <ljs@kernel.org>
Reviewed-by: Gregory Price <gourry@gourry.net>
quoted
+ /*
+ * 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).
Yeah I know, I do hope to refactor all this at some point to make it simpler,
but for the time being tried to make the confusing thing at least _slightly_
less confusing :)
~Gregory
Cheers, Lorenzo
quoted
+ /*
+ * 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
+ */