Peter Zijlstra 5b1e4fc298 kthread: Extract KTHREAD_IS_PER_CPU
[ Upstream commit ac687e6e8c26181a33270efd1a2e2241377924b0 ]

There is a need to distinguish geniune per-cpu kthreads from kthreads
that happen to have a single CPU affinity.

Geniune per-cpu kthreads are kthreads that are CPU affine for
correctness, these will obviously have PF_KTHREAD set, but must also
have PF_NO_SETAFFINITY set, lest userspace modify their affinity and
ruins things.

However, these two things are not sufficient, PF_NO_SETAFFINITY is
also set on other tasks that have their affinities controlled through
other means, like for instance workqueues.

Therefore another bit is needed; it turns out kthread_create_per_cpu()
already has such a bit: KTHREAD_IS_PER_CPU, which is used to make
kthread_park()/kthread_unpark() work correctly.

Expose this flag and remove the implicit setting of it from
kthread_create_on_cpu(); the io_uring usage of it seems dubious at
best.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Valentin Schneider <valentin.schneider@arm.com>
Tested-by: Valentin Schneider <valentin.schneider@arm.com>
Link: https://lkml.kernel.org/r/20210121103506.557620262@infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-02-07 15:35:49 +01:00
..
2019-08-09 09:15:05 +02:00
2019-09-17 10:27:46 -07:00
2019-07-17 09:55:43 -07:00
2020-02-19 19:53:09 +01:00
2019-07-08 09:54:55 -07:00
2019-09-19 16:24:24 -07:00
2019-08-20 22:09:52 +02:00
2019-08-28 21:17:12 -06:00
2019-09-17 19:15:14 -07:00
2019-09-23 11:21:04 -07:00
2019-09-18 10:33:46 -07:00
2019-09-05 19:52:33 -06:00
2021-01-23 15:57:55 +01:00
2019-09-25 09:55:59 -07:00
2021-01-30 13:54:11 +01:00
2021-01-06 14:48:35 +01:00
2020-03-25 08:25:58 +01:00
2019-07-12 15:13:55 -07:00
2019-09-05 11:40:54 +02:00
2019-06-25 12:59:43 +10:00
2019-09-29 10:33:41 -07:00
2019-10-02 06:36:50 -07:00
2019-11-08 08:46:49 -08:00
2019-07-05 21:34:50 +02:00
2019-06-26 13:19:46 -07:00
2019-09-07 04:28:05 -03:00
2019-12-13 08:42:53 +01:00
2019-09-02 11:43:54 +01:00
2021-02-07 15:35:49 +01:00
2019-09-05 12:32:05 +02:00
2019-09-29 10:33:41 -07:00
2019-12-13 08:43:18 +01:00
2020-07-29 10:18:36 +02:00
2019-08-14 15:30:35 +02:00
2019-08-08 09:09:25 +02:00
2019-07-16 19:23:25 -07:00
2020-03-18 07:17:46 +01:00
2019-08-01 21:49:46 +02:00
2019-07-31 19:03:35 +02:00
2020-04-17 10:50:12 +02:00
2020-04-02 15:11:00 +02:00
2019-10-31 14:01:40 -07:00
2019-09-25 17:51:41 -07:00
2019-09-07 21:42:25 +02:00
2019-10-02 10:06:45 +02:00
2019-08-01 20:51:22 +02:00
2019-07-31 19:03:35 +02:00
2020-12-11 13:23:28 +01:00
2019-07-13 10:36:53 -07:00
2020-04-02 15:11:00 +02:00
2019-07-14 16:51:47 -07:00