On 2022/09/20 0:10, Tao Liu wrote: > There are 2 ways to iterate vm_area_struct: 1) by rbtree, > aka vma.vm_rb; 2) by linked list, aka vma.vm_prev/next. > However for linux maple tree patch[1][2], vm_rb and vm_prev/next > are removed from vm_area_struct. For memory.c:vm_area_dump > of crash, it mainly uses linked list as a way of vma iteration, > which will not work for this case. So maple tree iteration > need to be ported to crash. > > For crash, currently it only iteratively read the maple tree, > no more rcu safe or maple tree modification features > needed. So we only port a subset of kernel maple tree > features. > > This patch mainly ports for_each_vma() macro, and all its > dependencies from kernel source[3] to crash, to enable crash > maple tree vma iteration: > > maple_tree_vma.h: The interface of maple tree vma iteration. > maple_tree.c: Maple tree main implementation. > maple_tree.h: Maple tree constants and structures. > xarray.h: Maple tree of xarray dependency.
Is it possible to put the other two header files into the maple_tree.h? > > [1]: > https://github.com/oracle/linux-uek/commit/d19703645b80abe35dff1a88449d074b0b5b1bb1 > [2]: > https://github.com/oracle/linux-uek/commit/91dee01f1ebb6b6587463b6ee6f7bbc4965f91d5 > [3]: https://github.com/oracle/linux-uek, maple/mainline branch This code looks a bit old, e.g. the following two lines are not found in the current mm-stable [1], though the maple tree will come soon mainline. typedef struct maple_enode *maple_enode; /* encoded node */ typedef struct maple_pnode *maple_pnode; /* parent node */ [1] https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git > > Signed-off-by: Tao Liu <l...@redhat.com> > --- > maple_tree.c | 736 +++++++++++++++++++++++++++++++++++++++++++++++ > maple_tree.h | 176 ++++++++++++ > maple_tree_vma.h | 31 ++ > xarray.h | 70 +++++ > 4 files changed, 1013 insertions(+) > create mode 100644 maple_tree.c > create mode 100644 maple_tree.h > create mode 100644 maple_tree_vma.h > create mode 100644 xarray.h > > diff --git a/maple_tree.c b/maple_tree.c > new file mode 100644 > index 0000000..a7db8fa > --- /dev/null > +++ b/maple_tree.c > @@ -0,0 +1,736 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * Maple Tree implementation > + * Copyright (c) 2018-2022 Oracle Corporation > + * Authors: Liam R. Howlett <liam.howl...@oracle.com> > + * Matthew Wilcox <wi...@infradead.org> For the copied parts, please add their kernel file path like "This code comes from lib/maple_tree.c". Thanks, Kazu -- Crash-utility mailing list Crash-utility@redhat.com https://listman.redhat.com/mailman/listinfo/crash-utility Contribution Guidelines: https://github.com/crash-utility/crash/wiki