Skip to content

Commit

Permalink
locking/osq_lock: Move the definition of optimistic_spin_node into os…
Browse files Browse the repository at this point in the history
…q_lock.c

struct optimistic_spin_node is private to the implementation.
Move it into the C file to ensure nothing is accessing it.

Signed-off-by: David Laight <david.laight@aculab.com>
Acked-by: Waiman Long <longman@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
David Laight authored and Linus Torvalds committed Dec 30, 2023
1 parent f016f75 commit 7c22309
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 0 additions & 5 deletions include/linux/osq_lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
* An MCS like lock especially tailored for optimistic spinning for sleeping
* lock implementations (mutex, rwsem, etc).
*/
struct optimistic_spin_node {
struct optimistic_spin_node *next, *prev;
int locked; /* 1 if lock acquired */
int cpu; /* encoded CPU # + 1 value */
};

struct optimistic_spin_queue {
/*
Expand Down
7 changes: 7 additions & 0 deletions kernel/locking/osq_lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
* called from interrupt context and we have preemption disabled while
* spinning.
*/

struct optimistic_spin_node {
struct optimistic_spin_node *next, *prev;
int locked; /* 1 if lock acquired */
int cpu; /* encoded CPU # + 1 value */
};

static DEFINE_PER_CPU_SHARED_ALIGNED(struct optimistic_spin_node, osq_node);

/*
Expand Down

0 comments on commit 7c22309

Please sign in to comment.