Skip to content

sched/wait: Replace wait_on_atomic_t() with wait_var_event()

Peter Zijlstra lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest11 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11sched/wait: Introduce wait_var_event()include/linux/wait_bit.h kernel/sched/wait_bit.c+118 -01 reply
2/11sched/wait,drm: Replace wait_on_atomic_t usagedrivers/gpu/drm/drm_dp_aux_dev.c drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c+11 -161 reply
3/11sched/wait,media: Replace wait_on_atomic_t usagedrivers/media/platform/qcom/venus/hfi.c+4 -40 replies
4/11sched/wait,afs: Replace wait_on_atomic_t usagefs/afs/cell.c fs/afs/rxrpc.c fs/afs/server.c+9 -90 replies
5/11sched/wait,btrfs: Replace wait_on_atomic_t usagefs/btrfs/extent-tree.c fs/btrfs/ioctl.c+7 -91 reply
6/11sched/wait,fscache: Replace wait_on_atomic_t usagefs/fscache/cookie.c include/linux/fscache-cache.h+5 -40 replies
7/11sched/wait,nfs: Replace wait_on_atomic_t usagefs/nfs/inode.c fs/nfs/pagelist.c fs/nfs/pnfs_nfs.c +1 more+7 -120 replies
8/11sched/wait,ocfs2: Replace wait_on_atomic_t usagefs/ocfs2/filecheck.c+5 -40 replies
9/11sched/wait,mips: Fix and replace wait_on_atomic_t usagearch/mips/kernel/process.c arch/mips/kernel/traps.c+4 -20 replies
10/11sched/wait: Remove wait_on_atomic_t()include/linux/wait_bit.h kernel/sched/wait_bit.c+0 -1280 replies
11/11sched/wait: Improve __var_waitqueue()kernel/sched/wait_bit.c+1 -60 replies

Reviews trailers per patch

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

PatchDan WilliamsChris WilsonDavid Sterba
1/11T-b
2/11R-b
3/11
4/11
5/11A-b
6/11
7/11
8/11
9/11
10/11
11/11

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH 00/11] sched/wait: Replace wait_on_atomic_t() with wait_var_event()

I never really liked the whole wait_on_atomic_t() because of the hard-coded type and condition. And when Dan proposed to add 50+ lines of duplication to implement wait_on_atomic_one() I figured that was it.

Instead implement wait_var_event(), which at the fundamental level is much the same hashed-waitqueue as wait_on_atomic_t() is, but it doesn't care about the type or condition.

It is further modelled on the existing wait_event() API and is otherwise consistent with that.

The existing:

  wait_for_atomic_t(&my_atomic, wait_atomic_t, TASK_UNINTERRUPTIBLE);
  wake_up_atomic_t(&my_atomic);

can be replaced with:

  wait_var_event(&my_atomic, !atomic_read(&my_atomic));
  wake_up_var(&my_atomic);

And Dan can do what he needs done using:

  wait_var_event(&my_atomic, atomic_read(&my_atomic) == 1);
---
 arch/mips/kernel/process.c                         |   2 +
 arch/mips/kernel/traps.c                           |   4 +-
 drivers/gpu/drm/drm_dp_aux_dev.c                   |  13 +--
 drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c |  14 +--
 drivers/media/platform/qcom/venus/hfi.c            |   8 +-
 fs/afs/cell.c                                      |   6 +-
 fs/afs/rxrpc.c                                     |   6 +-
 fs/afs/server.c                                    |   6 +-
 fs/btrfs/extent-tree.c                             |  14 ++-
 fs/btrfs/ioctl.c                                   |   2 +-
 fs/fscache/cookie.c                                |   7 +-
 fs/nfs/inode.c                                     |   5 -
 fs/nfs/pagelist.c                                  |   6 +-
 fs/nfs/pnfs_nfs.c                                  |   2 +-
 fs/nfs/write.c                                     |   6 +-
 fs/ocfs2/filecheck.c                               |   9 +-
 include/linux/fscache-cache.h                      |   2 +-
 include/linux/wait_bit.h                           |  95 +++++++++++++-----
 kernel/sched/wait_bit.c                            | 110 +++++----------------
 19 files changed, 147 insertions(+), 170 deletions(-)