// SPDX-License-Identifier: GPL-2.0/* kernel/rwsem.c: R/W semaphores, public implementation * * Written by David Howells (dhowells@redhat.com). * Derived from asm-i386/semaphore.h * * Writer lock-stealing by Alex Shi <alex.shi@intel.com> * and Michel Lespinasse <walken@google.com> * * Optimistic spinning by Tim Chen <tim.c.chen@intel.com> * and Davidlohr Bueso <davidlohr@hp.com>. Based on mutexes. * * Rwsem count bit fields re-definition and rwsem rearchitecture by * Waiman Long <longman@redhat.com> and * Peter Zijlstra <peterz@infradead.org>. */#include<linux/types.h>#include<linux/kernel.h>#include<linux/sched.h>#include<linux/sched/rt.h>#include<linux/sched/task.h>#include<linux/sched/debug.h>#include<linux/sched/wake_q.h>#include<linux/sched/signal.h>#include<linux/sched/clock.h>#include<linux/export.h>#include<linux/rwsem.h>#include<linux/atomic.h>#include"lock_events.h"/* * The least significant 2 bits of the owner value has the following * meanings when set. *