Skip to content

introduce task_rcu_dereference()

Oleg Nesterov lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 15 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3probe_kernel_address() can use __probe_kernel_read()include/linux/uaccess.h+2 -150 replies
2/3introduce probe_slab_address()include/linux/uaccess.h mm/slub.c+16 -59 replies
3/3introduce task_rcu_dereference()include/linux/sched.h kernel/exit.c+50 -06 replies

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchChristoph LameterKirill Tkhai
1/3
2/3A-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] introduce task_rcu_dereference()

Peter, let me repeat once again, if you still prefer to avoid probe_slab_address() and use SLAB_DESTROY_BY_RCU I won't argue.

I do not like SLAB_DESTROY_BY_RCU in this particular case. With or without SDBR rq->curr can be reused and we need to avoid this race. The fact that with SDBR it can be reused only as another instance of task_struct is absolutely immaterial imo.

Not to mention that SDBR still adds some overhead while probe_slab() is free unless CONFIG_DEBUG_PAGEALLOC, but this option adds a large slowdown anyway.

However, my arguments against SDBR are not strictly technical, and I think that this falls into "maintainer is always right" category.

So please tell me if you prefer v2 with SDBR. In this case 2/3 is not needed, and 3/3 can simply read ->sighand. Otherwise the code (and even the comments) will be the same.

Compared to the draft patch I sent before

- update the comments

- do not use ERR_PTR(), just return the task or NULL, so kernel/sched/ doesn't need another helper.

This means that task_rcu_dereference() does retry itself. We can add __task_rcu_dereference() if we have another which do not need/want to retry.

Oleg.

 include/linux/sched.h   |    1 +
 include/linux/uaccess.h |   30 +++++++++++++++-------------
 kernel/exit.c           |   49 +++++++++++++++++++++++++++++++++++++++++++++++
 mm/slub.c               |    6 +----
 4 files changed, 67 insertions(+), 19 deletions(-)