Commit e5548f8
shmem: fix smaps BUG sleeping while atomic
smaps_pte_hole_lookup() is calling shmem_partial_swap_usage() with page
table lock held: but shmem_partial_swap_usage() does cond_resched_rcu() if
need_resched(): "BUG: sleeping function called from invalid context".
Since shmem_partial_swap_usage() is designed to count across a range, but
smaps_pte_hole_lookup() only calls it for a single page slot, just break
out of the loop on the last or only page, before checking need_resched().
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 2301003 ("mm/smaps: simplify shmem handling of pte holes")
Signed-off-by: Hugh Dickins <[email protected]>
Acked-by: Peter Xu <[email protected]>
Cc: <[email protected]> [5.16+]
Signed-off-by: Andrew Morton <[email protected]>1 parent f84f62e commit e5548f8
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
806 | 806 | | |
807 | 807 | | |
808 | 808 | | |
| 809 | + | |
809 | 810 | | |
810 | 811 | | |
811 | | - | |
| 812 | + | |
812 | 813 | | |
813 | 814 | | |
814 | 815 | | |
815 | 816 | | |
816 | | - | |
| 817 | + | |
| 818 | + | |
817 | 819 | | |
818 | 820 | | |
819 | 821 | | |
| |||
0 commit comments