XenevaOS
Loading...
Searching...
No Matches
task.h
Go to the documentation of this file.
1#ifndef __DCL_LINUX_SCHED_TASK_H__
2#define __DCL_LINUX_SCHED_TASK_H__
3
4#include <linux/sched.h> /* struct task_struct, for the pair below */
5
6/*
7 * DCL <linux/sched/task.h> -- put_task_struct(), the release half of a task
8 * reference.
9 *
10 * Filled from tty_ldsem.c:98 and :217, which drop the reference taken when a
11 * waiter was queued (`get_task_struct(waiter->task)` on the way in). Those
12 * are the only two uses in anything staged, and they are why the body is a
13 * no-op rather than a decrement: mainline's is
14 *
15 * if (refcount_dec_and_test(&t->usage)) __put_task_struct(t);
16 *
17 * and there is no __put_task_struct() to reach -- DCL's struct task_struct is
18 * never freed (sched.h has no free path for one), so its reference count has
19 * no last-holder event. Decrementing a counter whose crossing does nothing
20 * would be a read-modify-write on a field that does not exist.
21 *
22 * The pointer is taken because the call site's argument is one, not because
23 * it is used.
24 *
25 * get_task_struct() is the other half and is here for the same reason
26 * tty_ldsem.c:184 needs it -- `get_task_struct(current)` before parking on
27 * the semaphore, `put_task_struct(waiter->task)` when the queue drains. It
28 * is a no-op for the matching reason: with no free path for a task_struct,
29 * acquiring a reference to one cannot fail or overflow anything either. The
30 * pair is supplied together because a one-sided refcount protocol is exactly
31 * the sort of thing that reads as correct until the second side is added.
32 *
33 * upstream include/linux/sched/task.h
34 */
35static inline void get_task_struct(struct task_struct* t)
36{
37 (void)t;
38}
39
40static inline void put_task_struct(struct task_struct* t)
41{
42 (void)t;
43}
44
45#endif /* __DCL_LINUX_SCHED_TASK_H__ */
XETime t
Definition main.cpp:53
Definition sched.h:121