PERFORCE change 125459 for review
Jesper Brix Rosenkilde
jbr at FreeBSD.org
Mon Aug 20 14:55:02 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=125459
Change 125459 by jbr at jbr_bob on 2007/08/20 21:54:48
sync with current
Affected files ...
.. //depot/projects/soc2007/jbr-syscall/src/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c#2 integrate
.. //depot/projects/soc2007/jbr-syscall/src/sys/kern/kern_cpu.c#3 integrate
.. //depot/projects/soc2007/jbr-syscall/src/sys/kern/kern_switch.c#3 integrate
.. //depot/projects/soc2007/jbr-syscall/src/sys/kern/sched_ule.c#3 integrate
.. //depot/projects/soc2007/jbr-syscall/src/sys/kern/vfs_aio.c#2 integrate
.. //depot/projects/soc2007/jbr-syscall/src/sys/vm/vm_map.c#13 integrate
.. //depot/projects/soc2007/jbr-syscall/src/sys/vm/vm_map.h#9 integrate
.. //depot/projects/soc2007/jbr-syscall/src/sys/vm/vm_mmap.c#2 integrate
Differences ...
==== //depot/projects/soc2007/jbr-syscall/src/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c#2 (text+ko) ====
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c,v 1.9 2007/05/30 03:03:05 kan Exp $
+ * $FreeBSD: src/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c,v 1.10 2007/08/20 15:33:22 cognet Exp $
*/
#include <sys/param.h>
@@ -131,25 +131,25 @@
args->logbufsize = -1;
parse_int(mp, "flags", &args->flags, &error);
- if (error != 0)
+ if (error != 0 && error != ENOENT)
return error;
args->flags |= XFSMNT_32BITINODES;
parse_int(mp, "sunit", &args->sunit, &error);
- if (error != 0)
+ if (error != 0 && error != ENOENT)
return error;
parse_int(mp, "swidth", &args->swidth, &error);
- if (error != 0)
+ if (error != 0 && error != ENOENT)
return error;
parse_int(mp, "logbufs", &args->logbufs, &error);
- if (error != 0)
+ if (error != 0 && error != ENOENT)
return error;
parse_int(mp, "logbufsize", &args->logbufsize, &error);
- if (error != 0)
+ if (error != 0 && error != ENOENT)
return error;
fsname = vfs_getopts(mp->mnt_optnew, "from", &error);
==== //depot/projects/soc2007/jbr-syscall/src/sys/kern/kern_cpu.c#3 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_cpu.c,v 1.26 2007/08/19 20:34:13 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_cpu.c,v 1.27 2007/08/20 06:28:26 njl Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -227,7 +227,7 @@
const struct cf_setting *set;
struct cf_saved_freq *saved_freq, *curr_freq;
struct pcpu *pc;
- int cpu_id, error, i;
+ int error, i;
sc = device_get_softc(dev);
error = 0;
@@ -294,22 +294,17 @@
goto out;
}
- /* Bind to the target CPU before switching, if necessary. */
- cpu_id = PCPU_GET(cpuid);
+ /* Bind to the target CPU before switching. */
pc = cpu_get_pcpu(set->dev);
- if (cpu_id != pc->pc_cpuid) {
- thread_lock(curthread);
- sched_bind(curthread, pc->pc_cpuid);
- thread_unlock(curthread);
- }
+ thread_lock(curthread);
+ sched_bind(curthread, pc->pc_cpuid);
+ thread_unlock(curthread);
CF_DEBUG("setting abs freq %d on %s (cpu %d)\n", set->freq,
device_get_nameunit(set->dev), PCPU_GET(cpuid));
error = CPUFREQ_DRV_SET(set->dev, set);
- if (cpu_id != pc->pc_cpuid) {
- thread_lock(curthread);
- sched_unbind(curthread);
- thread_unlock(curthread);
- }
+ thread_lock(curthread);
+ sched_unbind(curthread);
+ thread_unlock(curthread);
if (error) {
goto out;
}
@@ -323,22 +318,17 @@
goto out;
}
- /* Bind to the target CPU before switching, if necessary. */
- cpu_id = PCPU_GET(cpuid);
+ /* Bind to the target CPU before switching. */
pc = cpu_get_pcpu(set->dev);
- if (cpu_id != pc->pc_cpuid) {
- thread_lock(curthread);
- sched_bind(curthread, pc->pc_cpuid);
- thread_unlock(curthread);
- }
+ thread_lock(curthread);
+ sched_bind(curthread, pc->pc_cpuid);
+ thread_unlock(curthread);
CF_DEBUG("setting rel freq %d on %s (cpu %d)\n", set->freq,
device_get_nameunit(set->dev), PCPU_GET(cpuid));
error = CPUFREQ_DRV_SET(set->dev, set);
- if (cpu_id != pc->pc_cpuid) {
- thread_lock(curthread);
- sched_unbind(curthread);
- thread_unlock(curthread);
- }
+ thread_lock(curthread);
+ sched_unbind(curthread);
+ thread_unlock(curthread);
if (error) {
/* XXX Back out any successful setting? */
goto out;
==== //depot/projects/soc2007/jbr-syscall/src/sys/kern/kern_switch.c#3 (text+ko) ====
@@ -26,7 +26,7 @@
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_switch.c,v 1.133 2007/08/03 23:35:35 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_switch.c,v 1.134 2007/08/20 06:36:12 jeff Exp $");
#include "opt_sched.h"
@@ -360,45 +360,35 @@
}
static __inline int
-runq_findbit_from(struct runq *rq, u_char start)
+runq_findbit_from(struct runq *rq, u_char pri)
{
struct rqbits *rqb;
- int bit;
- int pri;
+ rqb_word_t mask;
int i;
+ /*
+ * Set the mask for the first word so we ignore priorities before 'pri'.
+ */
+ mask = (rqb_word_t)-1 << (pri & (RQB_BPW - 1));
rqb = &rq->rq_status;
- bit = start & (RQB_BPW -1);
- pri = 0;
- CTR1(KTR_RUNQ, "runq_findbit_from: start %d", start);
again:
- for (i = RQB_WORD(start); i < RQB_LEN; i++) {
- CTR3(KTR_RUNQ, "runq_findbit_from: bits %d = %#x bit = %d",
- i, rqb->rqb_bits[i], bit);
- if (rqb->rqb_bits[i]) {
- if (bit != 0) {
- for (pri = bit; pri < RQB_BPW; pri++)
- if (rqb->rqb_bits[i] & (1ul << pri))
- break;
- bit = 0;
- if (pri >= RQB_BPW)
- continue;
- } else
- pri = RQB_FFS(rqb->rqb_bits[i]);
- pri += (i << RQB_L2BPW);
- CTR3(KTR_RUNQ, "runq_findbit_from: bits=%#x i=%d pri=%d",
- rqb->rqb_bits[i], i, pri);
- return (pri);
- }
- bit = 0;
+ for (i = RQB_WORD(pri); i < RQB_LEN; mask = -1, i++) {
+ mask = rqb->rqb_bits[i] & mask;
+ if (mask == 0)
+ continue;
+ pri = RQB_FFS(mask) + (i << RQB_L2BPW);
+ CTR3(KTR_RUNQ, "runq_findbit_from: bits=%#x i=%d pri=%d",
+ mask, i, pri);
+ return (pri);
}
- if (start != 0) {
- CTR0(KTR_RUNQ, "runq_findbit_from: restarting");
- start = 0;
- goto again;
- }
-
- return (-1);
+ if (pri == 0)
+ return (-1);
+ /*
+ * Wrap back around to the beginning of the list just once so we
+ * scan the whole thing.
+ */
+ pri = 0;
+ goto again;
}
/*
==== //depot/projects/soc2007/jbr-syscall/src/sys/kern/sched_ule.c#3 (text+ko) ====
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.204 2007/08/04 01:21:28 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.205 2007/08/20 06:34:20 jeff Exp $");
#include "opt_hwpmc_hooks.h"
#include "opt_sched.h"
@@ -1328,6 +1328,12 @@
incr = 1;
tickincr = incr;
#ifdef SMP
+ /*
+ * Set steal thresh to log2(mp_ncpu) but no greater than 4. This
+ * prevents excess thrashing on large machines and excess idle on
+ * smaller machines.
+ */
+ steal_thresh = min(ffs(mp_ncpus) - 1, 4);
affinity = SCHED_AFFINITY_DEFAULT;
#endif
}
==== //depot/projects/soc2007/jbr-syscall/src/sys/kern/vfs_aio.c#2 (text+ko) ====
@@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/vfs_aio.c,v 1.232 2007/06/10 01:50:05 mjacob Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/vfs_aio.c,v 1.233 2007/08/20 11:53:26 kib Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -719,6 +719,7 @@
}
AIO_UNLOCK(ki);
taskqueue_drain(taskqueue_aiod_bio, &ki->kaio_task);
+ mtx_destroy(&ki->kaio_mtx);
uma_zfree(kaio_zone, ki);
p->p_aioinfo = NULL;
}
@@ -837,7 +838,10 @@
*/
if (cb->aio_lio_opcode == LIO_READ) {
auio.uio_rw = UIO_READ;
- error = fo_read(fp, &auio, fp->f_cred, FOF_OFFSET, td);
+ if (auio.uio_resid == 0)
+ error = 0;
+ else
+ error = fo_read(fp, &auio, fp->f_cred, FOF_OFFSET, td);
} else {
if (fp->f_type == DTYPE_VNODE)
bwillwrite();
==== //depot/projects/soc2007/jbr-syscall/src/sys/vm/vm_map.c#13 (text+ko) ====
@@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/vm/vm_map.c,v 1.386 2007/05/31 22:52:15 attilio Exp $");
+__FBSDID("$FreeBSD: src/sys/vm/vm_map.c,v 1.387 2007/08/20 12:05:45 kib Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -156,6 +156,22 @@
#define PROC_VMSPACE_LOCK(p) do { } while (0)
#define PROC_VMSPACE_UNLOCK(p) do { } while (0)
+/*
+ * VM_MAP_RANGE_CHECK: [ internal use only ]
+ *
+ * Asserts that the starting and ending region
+ * addresses fall within the valid range of the map.
+ */
+#define VM_MAP_RANGE_CHECK(map, start, end) \
+ { \
+ if (start < vm_map_min(map)) \
+ start = vm_map_min(map); \
+ if (end > vm_map_max(map)) \
+ end = vm_map_max(map); \
+ if (start > end) \
+ start = end; \
+ }
+
void
vm_map_startup(void)
{
@@ -1146,6 +1162,25 @@
return (0);
}
+int
+vm_map_fixed(vm_map_t map, vm_object_t object, vm_ooffset_t offset,
+ vm_offset_t *addr /* IN/OUT */, vm_size_t length, vm_prot_t prot,
+ vm_prot_t max, int cow)
+{
+ vm_offset_t start, end;
+ int result;
+
+ start = *addr;
+ vm_map_lock(map);
+ end = start + length;
+ VM_MAP_RANGE_CHECK(map, start, end);
+ (void) vm_map_delete(map, start, end);
+ result = vm_map_insert(map, object, offset, start, end, prot,
+ max, cow);
+ vm_map_unlock(map);
+ return (result);
+}
+
/*
* vm_map_find finds an unallocated region in the target address
* map with the given length. The search is defined to be
@@ -1356,22 +1391,6 @@
}
/*
- * VM_MAP_RANGE_CHECK: [ internal use only ]
- *
- * Asserts that the starting and ending region
- * addresses fall within the valid range of the map.
- */
-#define VM_MAP_RANGE_CHECK(map, start, end) \
- { \
- if (start < vm_map_min(map)) \
- start = vm_map_min(map); \
- if (end > vm_map_max(map)) \
- end = vm_map_max(map); \
- if (start > end) \
- start = end; \
- }
-
-/*
* vm_map_submap: [ kernel use only ]
*
* Mark the given range as handled by a subordinate map.
==== //depot/projects/soc2007/jbr-syscall/src/sys/vm/vm_map.h#9 (text+ko) ====
@@ -57,7 +57,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
- * $FreeBSD: src/sys/vm/vm_map.h,v 1.119 2006/05/29 21:28:56 tegge Exp $
+ * $FreeBSD: src/sys/vm/vm_map.h,v 1.120 2007/08/20 12:05:45 kib Exp $
*/
/*
@@ -333,6 +333,7 @@
vm_map_t vm_map_create(pmap_t, vm_offset_t, vm_offset_t);
int vm_map_delete (vm_map_t, vm_offset_t, vm_offset_t);
int vm_map_find (vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *, vm_size_t, boolean_t, vm_prot_t, vm_prot_t, int);
+int vm_map_fixed (vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *, vm_size_t, vm_prot_t, vm_prot_t, int);
int vm_map_findspace (vm_map_t, vm_offset_t, vm_size_t, vm_offset_t *);
int vm_map_inherit (vm_map_t, vm_offset_t, vm_offset_t, vm_inherit_t);
void vm_map_init (struct vm_map *, vm_offset_t, vm_offset_t);
==== //depot/projects/soc2007/jbr-syscall/src/sys/vm/vm_mmap.c#2 (text+ko) ====
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/vm/vm_mmap.c,v 1.212 2007/07/04 22:57:21 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/vm/vm_mmap.c,v 1.213 2007/08/20 12:05:45 kib Exp $");
#include "opt_compat.h"
#include "opt_hwpmc_hooks.h"
@@ -1341,7 +1341,6 @@
if (*addr != trunc_page(*addr))
return (EINVAL);
fitit = FALSE;
- (void) vm_map_remove(map, *addr, *addr + size);
}
/*
* Lookup/allocate object.
@@ -1400,8 +1399,11 @@
if (flags & MAP_STACK)
rv = vm_map_stack(map, *addr, size, prot, maxprot,
docow | MAP_STACK_GROWS_DOWN);
+ else if (fitit)
+ rv = vm_map_find(map, object, foff, addr, size, TRUE,
+ prot, maxprot, docow);
else
- rv = vm_map_find(map, object, foff, addr, size, fitit,
+ rv = vm_map_fixed(map, object, foff, addr, size,
prot, maxprot, docow);
if (rv != KERN_SUCCESS) {
More information about the p4-projects
mailing list