kern_rmlock.c (240424) | kern_rmlock.c (241374) |
---|---|
1/*- 2 * Copyright (c) 2007 Stephan Uphoff <ups@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * SUCH DAMAGE. 28 */ 29 30/* 31 * Machine independent bits of reader/writer lock implementation. 32 */ 33 34#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2007 Stephan Uphoff <ups@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * SUCH DAMAGE. 28 */ 29 30/* 31 * Machine independent bits of reader/writer lock implementation. 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/kern/kern_rmlock.c 240424 2012-09-12 22:10:53Z attilio $"); | 35__FBSDID("$FreeBSD: head/sys/kern/kern_rmlock.c 241374 2012-10-09 14:32:30Z attilio $"); |
36 37#include "opt_ddb.h" 38#include "opt_kdtrace.h" 39 40#include <sys/param.h> 41#include <sys/systm.h> 42 43#include <sys/kernel.h> --- 16 unchanged lines hidden (view full) --- 60#define RMPF_SIGNAL 2 61 62/* 63 * To support usage of rmlock in CVs and msleep yet another list for the 64 * priority tracker would be needed. Using this lock for cv and msleep also 65 * does not seem very useful 66 */ 67 | 36 37#include "opt_ddb.h" 38#include "opt_kdtrace.h" 39 40#include <sys/param.h> 41#include <sys/systm.h> 42 43#include <sys/kernel.h> --- 16 unchanged lines hidden (view full) --- 60#define RMPF_SIGNAL 2 61 62/* 63 * To support usage of rmlock in CVs and msleep yet another list for the 64 * priority tracker would be needed. Using this lock for cv and msleep also 65 * does not seem very useful 66 */ 67 |
68static __inline void compiler_memory_barrier(void) { 69 __asm __volatile("":::"memory"); 70} 71 | |
72static void assert_rm(const struct lock_object *lock, int what); 73static void lock_rm(struct lock_object *lock, int how); 74#ifdef KDTRACE_HOOKS 75static int owner_rm(const struct lock_object *lock, struct thread **owner); 76#endif 77static int unlock_rm(struct lock_object *lock); 78 79struct lock_class lock_class_rm = { --- 268 unchanged lines hidden (view full) --- 348 return (1); 349 350 tracker->rmp_flags = 0; 351 tracker->rmp_thread = td; 352 tracker->rmp_rmlock = rm; 353 354 td->td_critnest++; /* critical_enter(); */ 355 | 68static void assert_rm(const struct lock_object *lock, int what); 69static void lock_rm(struct lock_object *lock, int how); 70#ifdef KDTRACE_HOOKS 71static int owner_rm(const struct lock_object *lock, struct thread **owner); 72#endif 73static int unlock_rm(struct lock_object *lock); 74 75struct lock_class lock_class_rm = { --- 268 unchanged lines hidden (view full) --- 344 return (1); 345 346 tracker->rmp_flags = 0; 347 tracker->rmp_thread = td; 348 tracker->rmp_rmlock = rm; 349 350 td->td_critnest++; /* critical_enter(); */ 351 |
356 compiler_memory_barrier(); | 352 __compiler_membar(); |
357 358 pc = cpuid_to_pcpu[td->td_oncpu]; /* pcpu_find(td->td_oncpu); */ 359 360 rm_tracker_add(pc, tracker); 361 362 sched_pin(); 363 | 353 354 pc = cpuid_to_pcpu[td->td_oncpu]; /* pcpu_find(td->td_oncpu); */ 355 356 rm_tracker_add(pc, tracker); 357 358 sched_pin(); 359 |
364 compiler_memory_barrier(); | 360 __compiler_membar(); |
365 366 td->td_critnest--; 367 368 /* 369 * Fast path to combine two common conditions into a single 370 * conditional jump. 371 */ 372 if (0 == (td->td_owepreempt | --- 245 unchanged lines hidden --- | 361 362 td->td_critnest--; 363 364 /* 365 * Fast path to combine two common conditions into a single 366 * conditional jump. 367 */ 368 if (0 == (td->td_owepreempt | --- 245 unchanged lines hidden --- |