Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67d12145 authored by Al Viro's avatar Al Viro
Browse files

merge task_work and rcu_head, get rid of separate allocation for keyring case



task_work and rcu_head are identical now; merge them (calling the result
struct callback_head, rcu_head #define'd to it), kill separate allocation
in security/keys since we can just use cred->rcu now.

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 158e1645
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1405,7 +1405,7 @@ struct task_struct {
	int (*notifier)(void *priv);
	void *notifier_data;
	sigset_t *notifier_mask;
	void *task_works;
	struct callback_head *task_works;

	struct audit_context *audit_context;
#ifdef CONFIG_AUDITSYSCALL
+4 −10
Original line number Diff line number Diff line
@@ -4,22 +4,16 @@
#include <linux/list.h>
#include <linux/sched.h>

struct task_work;
typedef void (*task_work_func_t)(struct task_work *);

struct task_work {
	struct task_work *next;
	task_work_func_t func;
};
typedef void (*task_work_func_t)(struct callback_head *);

static inline void
init_task_work(struct task_work *twork, task_work_func_t func)
init_task_work(struct callback_head *twork, task_work_func_t func)
{
	twork->func = func;
}

int task_work_add(struct task_struct *task, struct task_work *twork, bool);
struct task_work *task_work_cancel(struct task_struct *, task_work_func_t);
int task_work_add(struct task_struct *task, struct callback_head *twork, bool);
struct callback_head *task_work_cancel(struct task_struct *, task_work_func_t);
void task_work_run(void);

static inline void exit_task_work(struct task_struct *task)
+5 −4
Original line number Diff line number Diff line
@@ -246,14 +246,15 @@ struct ustat {
};

/**
 * struct rcu_head - callback structure for use with RCU
 * struct callback_head - callback structure for use with RCU and task_work
 * @next: next update requests in a list
 * @func: actual update function to call after the grace period.
 */
struct rcu_head {
	struct rcu_head *next;
	void (*func)(struct rcu_head *head);
struct callback_head {
	struct callback_head *next;
	void (*func)(struct callback_head *head);
};
#define rcu_head callback_head

#endif	/* __KERNEL__ */
#endif /*  __ASSEMBLY__ */
+2 −2
Original line number Diff line number Diff line
@@ -781,7 +781,7 @@ static void wake_threads_waitq(struct irq_desc *desc)
		wake_up(&desc->wait_for_threads);
}

static void irq_thread_dtor(struct task_work *unused)
static void irq_thread_dtor(struct callback_head *unused)
{
	struct task_struct *tsk = current;
	struct irq_desc *desc;
@@ -813,7 +813,7 @@ static void irq_thread_dtor(struct task_work *unused)
 */
static int irq_thread(void *data)
{
	struct task_work on_exit_work;
	struct callback_head on_exit_work;
	static const struct sched_param param = {
		.sched_priority = MAX_USER_RT_PRIO/2,
	};
+7 −7
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
#include <linux/tracehook.h>

int
task_work_add(struct task_struct *task, struct task_work *twork, bool notify)
task_work_add(struct task_struct *task, struct callback_head *twork, bool notify)
{
	unsigned long flags;
	int err = -ESRCH;
@@ -19,8 +19,8 @@ task_work_add(struct task_struct *task, struct task_work *twork, bool notify)
	 */
	raw_spin_lock_irqsave(&task->pi_lock, flags);
	if (likely(!(task->flags & PF_EXITING))) {
		struct task_work *last = task->task_works;
		struct task_work *first = last ? last->next : twork;
		struct callback_head *last = task->task_works;
		struct callback_head *first = last ? last->next : twork;
		twork->next = first;
		if (last)
			last->next = twork;
@@ -35,16 +35,16 @@ task_work_add(struct task_struct *task, struct task_work *twork, bool notify)
	return err;
}

struct task_work *
struct callback_head *
task_work_cancel(struct task_struct *task, task_work_func_t func)
{
	unsigned long flags;
	struct task_work *last, *res = NULL;
	struct callback_head *last, *res = NULL;

	raw_spin_lock_irqsave(&task->pi_lock, flags);
	last = task->task_works;
	if (last) {
		struct task_work *q = last, *p = q->next;
		struct callback_head *q = last, *p = q->next;
		while (1) {
			if (p->func == func) {
				q->next = p->next;
@@ -66,7 +66,7 @@ task_work_cancel(struct task_struct *task, task_work_func_t func)
void task_work_run(void)
{
	struct task_struct *task = current;
	struct task_work *p, *q;
	struct callback_head *p, *q;

	raw_spin_lock_irq(&task->pi_lock);
	p = task->task_works;
Loading