forked from torvalds/linux
Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
seqlock: provide lockdep-free raw_seqcount_t variant
Sometimes it's required to have a seqcount implementation that uses
a structure with a fixed and minimal size -- just a bare unsigned int --
independent of the kernel configuration.
Let's provide a lockdep-free raw_seqcount_t variant that can be used via
the raw functions to have a basic seqlock and avoiding to reinventing
another variant for the special user.
The target use case is embedding a raw_seqcount_t in the "struct page",
where we really want a minimal size and cannot tolerate a sudden grow
of the seqcount_t structure resulting in a significant "struct page"
increase.
Provide raw_read_seqcount_retry(), to make it easy to match to
raw_read_seqcount_begin() in the code.
Example usage is
1) raw_seqcount_init() to init the raw_seqcount_t
2) raw_read_seqcount_begin() + raw_read_seqcount_retry() on the reader
side
3) raw_write_seqcount_begin() + raw_write_seqcount_end() on the writer
side, handling locking manually just as for seqcount_t.
Note: There might be other users of the raw_ variants where the lockdep
part is essentially unnecessary. One of such cases might be
seqcount_raw_spinlock_t users.
Signed-off-by: David Hildenbrand <david@redhat.com>- Loading branch information
1 parent
0fcfb00
commit f270db76384cb1df5a7f1b67226a8c8515583e5f
Showing
1 changed file
with
110 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters