sched_ule.c (174536) | sched_ule.c (174629) |
---|---|
1/*- 2 * Copyright (c) 2002-2007, Jeffrey Roberson <jeff@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 --- 22 unchanged lines hidden (view full) --- 31 * 32 * etymology: 33 * ULE is the last three letters in schedule. It owes its name to a 34 * generic user created for a scheduling system by Paul Mikesell at 35 * Isilon Systems and a general lack of creativity on the part of the author. 36 */ 37 38#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2002-2007, Jeffrey Roberson <jeff@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 --- 22 unchanged lines hidden (view full) --- 31 * 32 * etymology: 33 * ULE is the last three letters in schedule. It owes its name to a 34 * generic user created for a scheduling system by Paul Mikesell at 35 * Isilon Systems and a general lack of creativity on the part of the author. 36 */ 37 38#include <sys/cdefs.h> |
39__FBSDID("$FreeBSD: head/sys/kern/sched_ule.c 174536 2007-12-11 08:25:36Z davidxu $"); | 39__FBSDID("$FreeBSD: head/sys/kern/sched_ule.c 174629 2007-12-15 23:13:31Z jeff $"); |
40 41#include "opt_hwpmc_hooks.h" 42#include "opt_sched.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/kdb.h> 47#include <sys/kernel.h> --- 1841 unchanged lines hidden (view full) --- 1889 /* 1890 * Call the MD code to switch contexts if necessary. 1891 */ 1892 if (td != newtd) { 1893#ifdef HWPMC_HOOKS 1894 if (PMC_PROC_IS_USING_PMCS(td->td_proc)) 1895 PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT); 1896#endif | 40 41#include "opt_hwpmc_hooks.h" 42#include "opt_sched.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/kdb.h> 47#include <sys/kernel.h> --- 1841 unchanged lines hidden (view full) --- 1889 /* 1890 * Call the MD code to switch contexts if necessary. 1891 */ 1892 if (td != newtd) { 1893#ifdef HWPMC_HOOKS 1894 if (PMC_PROC_IS_USING_PMCS(td->td_proc)) 1895 PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT); 1896#endif |
1897 lock_profile_release_lock(&TDQ_LOCKPTR(tdq)->lock_object); |
|
1897 TDQ_LOCKPTR(tdq)->mtx_lock = (uintptr_t)newtd; 1898 cpu_switch(td, newtd, mtx); 1899 /* 1900 * We may return from cpu_switch on a different cpu. However, 1901 * we always return with td_lock pointing to the current cpu's 1902 * run queue lock. 1903 */ 1904 cpuid = PCPU_GET(cpuid); 1905 tdq = TDQ_CPU(cpuid); | 1898 TDQ_LOCKPTR(tdq)->mtx_lock = (uintptr_t)newtd; 1899 cpu_switch(td, newtd, mtx); 1900 /* 1901 * We may return from cpu_switch on a different cpu. However, 1902 * we always return with td_lock pointing to the current cpu's 1903 * run queue lock. 1904 */ 1905 cpuid = PCPU_GET(cpuid); 1906 tdq = TDQ_CPU(cpuid); |
1907 lock_profile_obtain_lock_success( 1908 &TDQ_LOCKPTR(tdq)->lock_object, 0, 0, __FILE__, __LINE__); |
|
1906#ifdef HWPMC_HOOKS 1907 if (PMC_PROC_IS_USING_PMCS(td->td_proc)) 1908 PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_IN); 1909#endif 1910 } else 1911 thread_unblock_switch(td, mtx); 1912 /* 1913 * Assert that all went well and return. --- 699 unchanged lines hidden (view full) --- 2613 tdq = TDQ_SELF(); 2614 if (td == NULL) { 2615 /* Correct spinlock nesting and acquire the correct lock. */ 2616 TDQ_LOCK(tdq); 2617 spinlock_exit(); 2618 } else { 2619 MPASS(td->td_lock == TDQ_LOCKPTR(tdq)); 2620 tdq_load_rem(tdq, td->td_sched); | 1909#ifdef HWPMC_HOOKS 1910 if (PMC_PROC_IS_USING_PMCS(td->td_proc)) 1911 PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_IN); 1912#endif 1913 } else 1914 thread_unblock_switch(td, mtx); 1915 /* 1916 * Assert that all went well and return. --- 699 unchanged lines hidden (view full) --- 2616 tdq = TDQ_SELF(); 2617 if (td == NULL) { 2618 /* Correct spinlock nesting and acquire the correct lock. */ 2619 TDQ_LOCK(tdq); 2620 spinlock_exit(); 2621 } else { 2622 MPASS(td->td_lock == TDQ_LOCKPTR(tdq)); 2623 tdq_load_rem(tdq, td->td_sched); |
2624 lock_profile_release_lock(&TDQ_LOCKPTR(tdq)->lock_object); |
|
2621 } 2622 KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count")); 2623 newtd = choosethread(); 2624 TDQ_LOCKPTR(tdq)->mtx_lock = (uintptr_t)newtd; 2625 PCPU_SET(switchtime, cpu_ticks()); 2626 PCPU_SET(switchticks, ticks); 2627 cpu_throw(td, newtd); /* doesn't return */ 2628} --- 16 unchanged lines hidden (view full) --- 2645 cpuid = PCPU_GET(cpuid); 2646 tdq = TDQ_CPU(cpuid); 2647 ts = td->td_sched; 2648 if (TD_IS_IDLETHREAD(td)) 2649 td->td_lock = TDQ_LOCKPTR(tdq); 2650 MPASS(td->td_lock == TDQ_LOCKPTR(tdq)); 2651 td->td_oncpu = cpuid; 2652 TDQ_LOCK_ASSERT(tdq, MA_OWNED | MA_NOTRECURSED); | 2625 } 2626 KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count")); 2627 newtd = choosethread(); 2628 TDQ_LOCKPTR(tdq)->mtx_lock = (uintptr_t)newtd; 2629 PCPU_SET(switchtime, cpu_ticks()); 2630 PCPU_SET(switchticks, ticks); 2631 cpu_throw(td, newtd); /* doesn't return */ 2632} --- 16 unchanged lines hidden (view full) --- 2649 cpuid = PCPU_GET(cpuid); 2650 tdq = TDQ_CPU(cpuid); 2651 ts = td->td_sched; 2652 if (TD_IS_IDLETHREAD(td)) 2653 td->td_lock = TDQ_LOCKPTR(tdq); 2654 MPASS(td->td_lock == TDQ_LOCKPTR(tdq)); 2655 td->td_oncpu = cpuid; 2656 TDQ_LOCK_ASSERT(tdq, MA_OWNED | MA_NOTRECURSED); |
2657 lock_profile_obtain_lock_success( 2658 &TDQ_LOCKPTR(tdq)->lock_object, 0, 0, __FILE__, __LINE__); |
|
2653} 2654 2655static SYSCTL_NODE(_kern, OID_AUTO, sched, CTLFLAG_RW, 0, 2656 "Scheduler"); 2657SYSCTL_STRING(_kern_sched, OID_AUTO, name, CTLFLAG_RD, "ULE", 0, 2658 "Scheduler name"); 2659SYSCTL_INT(_kern_sched, OID_AUTO, slice, CTLFLAG_RW, &sched_slice, 0, 2660 "Slice size for timeshare threads"); --- 32 unchanged lines hidden --- | 2659} 2660 2661static SYSCTL_NODE(_kern, OID_AUTO, sched, CTLFLAG_RW, 0, 2662 "Scheduler"); 2663SYSCTL_STRING(_kern_sched, OID_AUTO, name, CTLFLAG_RD, "ULE", 0, 2664 "Scheduler name"); 2665SYSCTL_INT(_kern_sched, OID_AUTO, slice, CTLFLAG_RW, &sched_slice, 0, 2666 "Slice size for timeshare threads"); --- 32 unchanged lines hidden --- |