initial work on making VMA flags a bitmap
Status from this message: [merged mm-stable] mm-introduce-vma-flags-bitmap-type.patch removed from -mm tree
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest4 patches 13 repliesApplied 4/4
- v24 patches 16 repliesSuperseded 3 of 4 applied
- v14 patches 18 repliesSuperseded
Changes in v3 from the cover letter
* Rebased against mm-new.
* Squashed fixups in to series.
* Propagated tags (thanks Vlasta!).
* After off-list discussion with Pedro Falcato, added defensive code in vm_flags_reset_once() to only clear bits higher than the first sytem word, retaining write-once semantics for the first system word, which is what callers are relying upon.
Patches in v3 All 4 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | mm: declare VMA flags by bitfs/ include/ mm/ +4 more | +524 | 7 replies | Applied |
| 2/4 | mm: simplify and rename mm flags function for clarityinclude/ kernel/ | +7 | 1 reply | Applied |
| 3/4 | tools/testing/vma: eliminate dependency on vma->__vm_flagstools/ | +10 | 1 reply | Applied |
| 4/4 | mm: introduce VMA flags bitmap typeinclude/ include/ rust/ +1 more | +202 | 1 reply | Applied |
Reviews trailers per patch
All 4 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Vlastimil Babka | Alice Ryhl | Pedro Falcato |
|---|---|---|---|
| Series | A-b | ||
| 1/4 | A-b | R-b | |
| 2/4 | A-b | R-b | |
| 3/4 | A-b | A-b | |
| 4/4 | A-b | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH v3 0/4] initial work on making VMA flags a bitmap
We are in the rather silly situation that we are running out of VMA flags as they are currently limited to a system word in size.
This leads to absurd situations where we limit features to 64-bit architectures only because we simply do not have the ability to add a flag for 32-bit ones.
This is very constraining and leads to hacks or, in the worst case, simply an inability to implement features we want for entirely arbitrary reasons.
This also of course gives us something of a Y2K type situation in mm where we might eventually exhaust all of the VMA flags even on 64-bit systems.
This series lays the groundwork for getting away from this limitation by establishing VMA flags as a bitmap whose size we can increase in future beyond 64 bits if required.
This is necessarily a highly iterative process given the extensive use of VMA flags throughout the kernel, so we start by performing basic steps.
Firstly, we declare VMA flags by bit number rather than by value, retaining the VM_xxx fields but in terms of these newly introduced VMA_xxx_BIT fields.
While we are here, we use sparse annotations to ensure that, when dealing with VMA bit number parameters, we cannot be passed values which are not declared as such - providing some useful type safety.
We then introduce an opaque VMA flag type, much like the opaque mm_struct flag type introduced in commit bb6525f2f8c4 ("mm: add bitmap mm->flags field"), which we establish in union with vma->vm_flags (but still set at system word size meaning there is no functional or data type size change).
We update the vm_flags_xxx() helpers to use this new bitmap, introducing sensible helpers to do so.
This series lays the foundation for further work to expand the use of bitmap VMA flags and eventually eliminate these arbitrary restrictions.
v3:
* Rebased against mm-new.
* Squashed fixups in to series.
* Propagated tags (thanks Vlasta!).
* After off-list discussion with Pedro Falcato, added defensive code in vm_flags_reset_once() to only clear bits higher than the first sytem word, retaining write-once semantics for the first system word, which is what callers are relying upon.
v2:
* Corrected kdoc for vma_flag_t.
* Introduced DECLARE_VMA_BIT() as per Jason. We can't also declare the VMA flags in the enum as this breaks assumptions in the kernel, resulting in errors like 'enum constant in boolean context [-Werror=int-in-bool-context]'.
* Dropped the conversion patch - To make life simpler this cycle, let's just fixup the flag declarations and introduce the new field type and introduce vm_flags_*() changes. We can do more later.
* Split out VMA testing vma->__vm_flags change.
* Fixed vma_flag_*_atomic() helper functions for sparse purposes to work with vma_flag_t.
* Fixed rust breakages as reported by Nico and help provided by Alice. For now we are doing a minimal fix, we can do a more substantial one once the VMA flag helper functions are introduced in an upcoming series.
https://lore.kernel.org/all/[email protected]>/
v1:
https://lore.kernel.org/all/[email protected]/
Lorenzo Stoakes (4):
mm: declare VMA flags by bit
mm: simplify and rename mm flags function for clarity tools/testing/vma: eliminate dependency on vma->__vm_flags
mm: introduce VMA flags bitmap type
fs/proc/task_mmu.c | 4 +- include/linux/mm.h | 401 +++++++++++++++------------ include/linux/mm_types.h | 78 +++++- kernel/fork.c | 4 +- mm/khugepaged.c | 2 +- mm/madvise.c | 2 +- rust/bindgen_parameters | 25 ++ rust/bindings/bindings_helper.h | 25 ++ rust/kernel/mm/virt.rs | 2 +- tools/testing/vma/vma.c | 20 +- tools/testing/vma/vma_internal.h | 454 ++++++++++++++++++++++++++----- 11 files changed, 742 insertions(+), 275 deletions(-)
--
2.51.2