]> Git Repo - linux.git/commit
mm/cma.c: remove redundant cma_mutex lock
authorLecopzer Chen <[email protected]>
Tue, 15 Dec 2020 03:13:23 +0000 (19:13 -0800)
committerLinus Torvalds <[email protected]>
Tue, 15 Dec 2020 20:13:46 +0000 (12:13 -0800)
commita4efc174b382fcdb62e2d90d39e78a274a975e38
tree2f5fcc927698c6b47cbac57eaaed34e8dd0907b3
parentd85c6db4cc61bd8299f68534bf7ea2f717f49539
mm/cma.c: remove redundant cma_mutex lock

The cma_mutex which protects alloc_contig_range() was first appeared in
commit 7ee793a62fa8c ("cma: Remove potential deadlock situation"), at that
time, there is no guarantee the behavior of concurrency inside
alloc_contig_range().

After commit 2c7452a075d4db2dc ("mm/page_isolation.c: make
start_isolate_page_range() fail if already isolated")

  > However, two subsystems (CMA and gigantic
  > huge pages for example) could attempt operations on the same range.  If
  > this happens, one thread may 'undo' the work another thread is doing.
  > This can result in pageblocks being incorrectly left marked as
  > MIGRATE_ISOLATE and therefore not available for page allocation.

The concurrency inside alloc_contig_range() was clarified.

Now we can find that hugepage and virtio call alloc_contig_range() without
any lock, thus cma_mutex is "redundant" in cma_alloc() now.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Lecopzer Chen <[email protected]>
Acked-by: David Hildenbrand <[email protected]>
Acked-by: Vlastimil Babka <[email protected]>
Cc: Matthias Brugger <[email protected]>
Cc: YJ Chiang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/cma.c
This page took 0.075095 seconds and 4 git commands to generate.