Skip to content

ptrace: task_clear_jobctl_trapping()->wake_up_bit() needs mb()

Oleg Nesterov linux-fsdevel linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1ptrace: task_clear_jobctl_trapping()->wake_up_bit() needs mb()kernel/signal.c+1 -02 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/1] ptrace: task_clear_jobctl_trapping()->wake_up_bit() needs mb()
Quoted 14 lines · Peter Zijlstra
Quoted 12 lines · Oleg Nesterov

I mean, we do not need mb() before __wake_up(). We need it only because __wake_up_bit() checks waitqueue_active().

And at least

	fs/cachefiles/namei.c:cachefiles_delete_object()
	fs/block_dev.c:blkdev_get()
	kernel/signal.c:task_clear_jobctl_trapping()
	security/keys/gc.c:key_garbage_collector()
Quoted 6 lines
Quoted 4 lines

look obviously wrong.

I would be happy to send the fix, but do I need to split it per-file? Given that it is trivial, perhaps I can send a single patch?

Since its all the same issue a single patch would be fine I think.

Actually blkdev_get() is fine, it relies on bdev_lock. But bd_prepare_to_claim() is the good example of abusing bit_waitqueue(). Not only it is itself suboptimal, this doesn't allow to optimize wake_up_bit-like paths. And there are more, say, inode_sleep_on_writeback(). Plus we have wait_on_atomic_t() which I think should be generalized or even unified with the regular wait_on_bit(). Perhaps I'll try to do this later, fortunately the recent patch from Neil greatly reduced the number of "action" functions.

As for cachefiles_walk_to_object() and key_garbage_collector(), it still seems to me they need smp_mb__after_clear_bit() but I'll leave this to David, I am not comfortable to change the code I absolutely do not understand. In particular, I fail to understand why key_garbage_collector() does smp_mb() before clear_bit(). At least it could be smp_mb__before_clear_bit().

So let me send a trivial patch which only changes task_clear_jobctl_trapping().

Oleg.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>