-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mm: drain TLB batching against CMA pages
MM has used TLB batching flush for memory unmapping. The batching scheme does memory batch freeing as well as TLB batching flush. Problem with CMA is process could schdule out once it kept holding refcount of pages. CPU 0 CPU 1 do_madvise/munmap/exit_mmap zap_pte_range __tlb_remove_page .. cma_alloc start sched out after 1sec keep failing since sched in .. tlb_flush free_pages_and_swap_cache page_refcount is zero, finally. page migration succeded cma_alloc returns If the process on CPU 0 is lower priority process, the CMA allocation latency depends on the scheduler, sometimes, which is priority inversion if process in CPU is higher priority. This patch tries to fix it via using TLB draining right before scheduling out(to release those pages immediately) if TLB has CMA pages in the batch. Bug: 238728493 Signed-off-by: Minchan Kim <[email protected]> Change-Id: Ifdcd1be670129d59adc4c0aff9c00d8e4ede7fe1
- Loading branch information
Minchan Kim
authored and
TreeHugger Robot
committed
Oct 27, 2022
1 parent
b4eaf5b
commit da334ed
Showing
4 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* memory.c | ||
* | ||
* Android Vendor Hook Support | ||
* | ||
* Copyright 2022 Google LLC | ||
*/ | ||
|
||
#include <linux/mm.h> | ||
|
||
void vh_zap_pte_range_tlb_start(void *data, void *unused) | ||
{ | ||
preempt_disable(); | ||
} | ||
|
||
void vh_zap_pte_range_tlb_force_flush(void *data, struct page *page, bool *flush) | ||
{ | ||
if (is_migrate_cma_page(page)) | ||
*flush = true; | ||
} | ||
|
||
void vh_zap_pte_range_tlb_end(void *data, void *unused) | ||
{ | ||
preempt_enable(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters