Skip to content

Commit 0ea5a52

Browse files
KAGA-KOKOjohnstultz-work
authored andcommitted
seqcount: Provide raw_read_seqcount()
raw_read_seqcount opens a read critical section of the given seqcount without any lockdep checking and without checking or masking the LSB. Calling code is responsible for handling that. Preparatory patch to provide a NMI safe clock monotonic accessor function. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: John Stultz <john.stultz@linaro.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: John Stultz <john.stultz@linaro.org>
1 parent 0e5ac3a commit 0ea5a52

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

include/linux/seqlock.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,22 @@ static inline unsigned __read_seqcount_begin(const seqcount_t *s)
116116
return ret;
117117
}
118118

119+
/**
120+
* raw_read_seqcount - Read the raw seqcount
121+
* @s: pointer to seqcount_t
122+
* Returns: count to be passed to read_seqcount_retry
123+
*
124+
* raw_read_seqcount opens a read critical section of the given
125+
* seqcount without any lockdep checking and without checking or
126+
* masking the LSB. Calling code is responsible for handling that.
127+
*/
128+
static inline unsigned raw_read_seqcount(const seqcount_t *s)
129+
{
130+
unsigned ret = ACCESS_ONCE(s->sequence);
131+
smp_rmb();
132+
return ret;
133+
}
134+
119135
/**
120136
* raw_read_seqcount_begin - start seq-read critical section w/o lockdep
121137
* @s: pointer to seqcount_t

0 commit comments

Comments
 (0)