Skip to content

mm/highmem: Preemptible variant of kmap_atomic & friends

Thomas Gleixner linux-mm lkml netdev 4 versions – Applied

Status from this message: The following commit has been merged into the sched/core branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest8 patches 31 repliesApplied
  2. v337 patches 8 repliesApplied
  3. v218 patches 31 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v1 RFC15 patches38 repliesSuperseded

Changes in v4 from the cover letter

- Rebased on top of the merged consolidation patches and on top of the latest version of migrate disable support.

- New debug features (enforced mappings)

- Dropped the conversion patches as they need review from the respective subsystems and better go through the relevant trees for 5.12

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/8mm/highmem: Provide and use CONFIG_DEBUG_KMAP_LOCALinclude/asm-generic/kmap_size.h lib/Kconfig.debug mm/highmem.c+11 -30 replies
2/8mm/highmem: Provide CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAPlib/Kconfig.debug mm/highmem.c+25 -13 replies
3/8x86: Support kmap_local() forced debuggingarch/x86/Kconfig arch/x86/include/asm/fixmap.h arch/x86/include/asm/pgtable_64_types.h+15 -410 replies
4/8sched: Make migrate_disable/enable() independent of RTinclude/linux/kernel.h include/linux/preempt.h include/linux/sched.h +3 more+56 -5613 replies
5/8sched: highmem: Store local kmaps in task structinclude/linux/highmem-internal.h include/linux/sched.h kernel/entry/common.c +3 more+129 -104 replies
6/8mm/highmem: Provide kmap_local*include/linux/highmem-internal.h include/linux/highmem.h mm/highmem.c+81 -160 replies
7/8io-mapping: Provide iomap_local variantDocumentation/driver-api/io-mapping.rst include/linux/io-mapping.h+74 -320 replies
8/8x86/crashdump/32: Simplify copy_oldmem_page()arch/x86/kernel/crash_dump_32.c+10 -380 replies

Reviews trailers per patch

None of the 8 patches has a Reviewed-by or Acked-by.

PatchPeter Zijlstra (Intel)Steven Rostedt (VMware)
SeriesGrudgingly-Acked-by
1/8
2/8
3/8T-b
4/8
5/8
6/8
7/8
8/8

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [patch V4 0/8] mm/highmem: Preemptible variant of kmap_atomic & friends

This is the outstanding set of patches for the preemptible kmap_*() implementation. The previous version is here:

https://lore.kernel.org/r/[email protected]

The following changes come with it:

- Better debugging for kmap* by enforcing the temporary mappings even for lowmem pages when the architecture allows it.

- Support for enforced mappings on X86 for both 32 and 64 bit. As KMAP_LOCAL is already independent from HIGHMEM this needs only the extra fixmap space on 64bit and no further code changes.

- Removing the RT dependency from migrate_disable/enable(). This patch still needs some help from the scheduler folks vs. the comment in preempt.h.

- Switching from per CPU storage of the kmap index to a per task storage by adding a pteval array to the per task storage which contains the ptevals of the currently active temporary kmaps

- Adding context switch code which checks whether the outgoing or the incoming task has active temporary kmaps. If so, the outgoing task's kmaps are removed and the incoming task's kmaps are restored.

- Adding new interfaces k[un]map_local*() which are not disabling preemption and can be called from any context (except NMI).

Contrary to kmap() which provides preemptible and "persistant" mappings, these interfaces are meant to replace the temporary mappings provided by kmap_atomic*() today.

This allows to get rid of conditional mapping choices and allows to have preemptible short term "mappings" on 64bit which are today enforced to be non-preemptible due to the highmem constraints. It clearly puts overhead on the highmem users, but highmem is slow anyway.

This is not a wholesale conversion which makes kmap_atomic magically preemptible because there might be usage sites which rely on the implicit preempt disable. So this needs to be done on a case by case basis and the call sites converted to kmap_local().

Changes vs. V3:

- Rebased on top of the merged consolidation patches and on top of the latest version of migrate disable support.

- New debug features (enforced mappings)

- Dropped the conversion patches as they need review from the respective subsystems and better go through the relevant trees for 5.12

The series is based on

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/mm

with

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core

merged in.

It is also available from git:

git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git highmem

Thanks,

tglx

---
 Documentation/driver-api/io-mapping.rst |   74 +++++++++++--------
 arch/x86/Kconfig                        |    1 
 arch/x86/include/asm/fixmap.h           |   12 ++-
 arch/x86/include/asm/pgtable_64_types.h |    6 +
 arch/x86/kernel/crash_dump_32.c         |   48 ++----------
 include/asm-generic/kmap_size.h         |    2 
 include/linux/highmem-internal.h        |   58 +++++++++++++++
 include/linux/highmem.h                 |   43 +++++++----
 include/linux/io-mapping.h              |   30 +++++++
 include/linux/kernel.h                  |   21 +++--
 include/linux/preempt.h                 |   38 ----------
 include/linux/sched.h                   |   11 ++
 kernel/entry/common.c                   |    2 
 kernel/fork.c                           |    1 
 kernel/sched/core.c                     |   63 ++++++++++++++--
 kernel/sched/sched.h                    |    4 -
 lib/Kconfig.debug                       |   22 +++++
 lib/smp_processor_id.c                  |    2 
 mm/highmem.c                            |  121 ++++++++++++++++++++++++++++----
 19 files changed, 400 insertions(+), 159 deletions(-)