0cd397d336
This patch creates a synchronize_srcu_expedited() that uses synchronize_sched_expedited() where synchronize_srcu() uses synchronize_sched(). The synchronize_srcu() and synchronize_srcu_expedited() functions become one-liners that pass synchronize_sched() or synchronize_sched_expedited(), repectively, to a new __synchronize_srcu() function. While in the file, move the EXPORT_SYMBOL_GPL()s to immediately follow the corresponding functions. Requested-by: Avi Kivity <avi@redhat.com> Tested-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Acked-by: Josh Triplett <josh@joshtriplett.org> Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: dipankar@in.ibm.com Cc: mathieu.desnoyers@polymtl.ca Cc: dvhltc@us.ibm.com Cc: niv@us.ibm.com Cc: peterz@infradead.org Cc: rostedt@goodmis.org Cc: Valdis.Kletnieks@vt.edu Cc: dhowells@redhat.com Cc: avi@redhat.com LKML-Reference: <12565226354038-git-send-email-> Signed-off-by: Ingo Molnar <mingo@elte.hu>
55 lines
1.7 KiB
C
55 lines
1.7 KiB
C
/*
|
|
* Sleepable Read-Copy Update mechanism for mutual exclusion
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*
|
|
* Copyright (C) IBM Corporation, 2006
|
|
*
|
|
* Author: Paul McKenney <paulmck@us.ibm.com>
|
|
*
|
|
* For detailed explanation of Read-Copy Update mechanism see -
|
|
* Documentation/RCU/ *.txt
|
|
*
|
|
*/
|
|
|
|
#ifndef _LINUX_SRCU_H
|
|
#define _LINUX_SRCU_H
|
|
|
|
struct srcu_struct_array {
|
|
int c[2];
|
|
};
|
|
|
|
struct srcu_struct {
|
|
int completed;
|
|
struct srcu_struct_array *per_cpu_ref;
|
|
struct mutex mutex;
|
|
};
|
|
|
|
#ifndef CONFIG_PREEMPT
|
|
#define srcu_barrier() barrier()
|
|
#else /* #ifndef CONFIG_PREEMPT */
|
|
#define srcu_barrier()
|
|
#endif /* #else #ifndef CONFIG_PREEMPT */
|
|
|
|
int init_srcu_struct(struct srcu_struct *sp);
|
|
void cleanup_srcu_struct(struct srcu_struct *sp);
|
|
int srcu_read_lock(struct srcu_struct *sp) __acquires(sp);
|
|
void srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp);
|
|
void synchronize_srcu(struct srcu_struct *sp);
|
|
void synchronize_srcu_expedited(struct srcu_struct *sp);
|
|
long srcu_batches_completed(struct srcu_struct *sp);
|
|
|
|
#endif
|