dc68054305
- Restore 29 recipe symlinks (libdrm, qtbase, dbus, sddm, pipewire, etc.) - Restore 33 patches (KDE, libdrm, mesa, pipewire, sddm, wireplumber) - Restore 20+ local/scripts (audit, lint, test, build helpers) - Restore src/cook/scheduler.rs, status.rs, gnu-config/ - Restore scripts/patch-inclusion-gate.sh, run_mini1.sh, validate-collision-log.sh - Recover TLC source from HEAD (was overwritten by 0.2.3 checkout) - Recover 11 local/docs plans from HEAD (were overwritten) - Recover qt6-wayland-smoke symlink from HEAD - Fix MOTD: remove garbled ASCII art, use clean text - Update version: 0.2.0 -> 0.2.4 in os-release, motd, config - Reduce filesystem_size: 1536 -> 512 MiB - Add ABSOLUTE RULE to AGENTS.md: never delete/ignore packages - Reduce pcid scheme log verbosity: info -> debug
66 lines
1.9 KiB
C
66 lines
1.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
#ifndef LINUX_RESUME_USER_MODE_H
|
|
#define LINUX_RESUME_USER_MODE_H
|
|
|
|
#include <linux/sched.h>
|
|
#include <linux/task_work.h>
|
|
#include <linux/memcontrol.h>
|
|
#include <linux/rseq.h>
|
|
#include <linux/blk-cgroup.h>
|
|
|
|
/**
|
|
* set_notify_resume - cause resume_user_mode_work() to be called
|
|
* @task: task that will call resume_user_mode_work()
|
|
*
|
|
* Calling this arranges that @task will call resume_user_mode_work()
|
|
* before returning to user mode. If it's already running in user mode,
|
|
* it will enter the kernel and call resume_user_mode_work() soon.
|
|
* If it's blocked, it will not be woken.
|
|
*/
|
|
static inline void set_notify_resume(struct task_struct *task)
|
|
{
|
|
if (!test_and_set_tsk_thread_flag(task, TIF_NOTIFY_RESUME))
|
|
kick_process(task);
|
|
}
|
|
|
|
|
|
/**
|
|
* resume_user_mode_work - Perform work before returning to user mode
|
|
* @regs: user-mode registers of @current task
|
|
*
|
|
* This is called when %TIF_NOTIFY_RESUME has been set. Now we are
|
|
* about to return to user mode, and the user state in @regs can be
|
|
* inspected or adjusted. The caller in arch code has cleared
|
|
* %TIF_NOTIFY_RESUME before the call. If the flag gets set again
|
|
* asynchronously, this will be called again before we return to
|
|
* user mode.
|
|
*
|
|
* Called without locks.
|
|
*/
|
|
static inline void resume_user_mode_work(struct pt_regs *regs)
|
|
{
|
|
clear_thread_flag(TIF_NOTIFY_RESUME);
|
|
/*
|
|
* This barrier pairs with task_work_add()->set_notify_resume() after
|
|
* hlist_add_head(task->task_works);
|
|
*/
|
|
smp_mb__after_atomic();
|
|
if (unlikely(task_work_pending(current)))
|
|
task_work_run();
|
|
|
|
#ifdef CONFIG_KEYS_REQUEST_CACHE
|
|
if (unlikely(current->cached_requested_key)) {
|
|
key_put(current->cached_requested_key);
|
|
current->cached_requested_key = NULL;
|
|
}
|
|
#endif
|
|
|
|
mem_cgroup_handle_over_high(GFP_KERNEL);
|
|
blkcg_maybe_throttle_current();
|
|
|
|
rseq_handle_slowpath(regs);
|
|
}
|
|
|
|
#endif /* LINUX_RESUME_USER_MODE_H */
|