Revert "sched/core: Disable page allocation in task_tick_mm_cid()"

This reverts commit 509c29d0d2 which is
commit 73ab05aa46 upstream.

It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.

Bug: 161946584
Change-Id: Id1beffd1efc63e2abfd1881b2042e84e0ad45a07
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman 2024-12-02 16:20:39 +00:00
parent c73311cb64
commit fb1b396b69
3 changed files with 4 additions and 20 deletions

View File

@ -14,14 +14,11 @@ init_task_work(struct callback_head *twork, task_work_func_t func)
} }
enum task_work_notify_mode { enum task_work_notify_mode {
TWA_NONE = 0, TWA_NONE,
TWA_RESUME, TWA_RESUME,
TWA_SIGNAL, TWA_SIGNAL,
TWA_SIGNAL_NO_IPI, TWA_SIGNAL_NO_IPI,
TWA_NMI_CURRENT, TWA_NMI_CURRENT,
TWA_FLAGS = 0xff00,
TWAF_NO_ALLOC = 0x0100,
}; };
static inline bool task_work_pending(struct task_struct *task) static inline bool task_work_pending(struct task_struct *task)

View File

@ -12304,9 +12304,7 @@ void task_tick_mm_cid(struct rq *rq, struct task_struct *curr)
return; return;
if (time_before(now, READ_ONCE(curr->mm->mm_cid_next_scan))) if (time_before(now, READ_ONCE(curr->mm->mm_cid_next_scan)))
return; return;
task_work_add(curr, work, TWA_RESUME);
/* No page allocation under rq lock */
task_work_add(curr, work, TWA_RESUME | TWAF_NO_ALLOC);
} }
void sched_mm_cid_exit_signals(struct task_struct *t) void sched_mm_cid_exit_signals(struct task_struct *t)

View File

@ -53,23 +53,12 @@ int task_work_add(struct task_struct *task, struct callback_head *work,
enum task_work_notify_mode notify) enum task_work_notify_mode notify)
{ {
struct callback_head *head; struct callback_head *head;
int flags = notify & TWA_FLAGS;
notify &= ~TWA_FLAGS;
if (notify == TWA_NMI_CURRENT) { if (notify == TWA_NMI_CURRENT) {
if (WARN_ON_ONCE(task != current)) if (WARN_ON_ONCE(task != current))
return -EINVAL; return -EINVAL;
} else { } else {
/* /* record the work call stack in order to print it in KASAN reports */
* Record the work call stack in order to print it in KASAN
* reports.
*
* Note that stack allocation can fail if TWAF_NO_ALLOC flag
* is set and new page is needed to expand the stack buffer.
*/
if (flags & TWAF_NO_ALLOC)
kasan_record_aux_stack_noalloc(work);
else
kasan_record_aux_stack(work); kasan_record_aux_stack(work);
} }