Having used spinlocks, using the reader-writer variant is straightforward; the lock data type is abstracted as the rwlock_t structure (in place of spinlock_t) and, in terms of API names, simply substitute read or write in place of spin:
#include <linux/rwlock.h>
rwlock_t mylist_lock;
The most basic APIs of the reader-writer spinlock are as follows:
void read_lock(rwlock_t *lock);
void write_lock(rwlock_t *lock);
As an example, the kernel's tty layer has code to handle a Secure Attention Key (SAK); the SAK is a security feature, a means to prevent a Trojan horse-type credentials hack by killing all processes associated with the TTY device. This will happen when the user presses the SAK (https://www.kernel.org/doc/html/latest/security/sak.html). When this actually happens (that is, when the user presses the SAK, mapped to the Alt-SysRq-k sequence by default), within its code path, it has to iterate over all tasks...