Date: Tue, 18 Jul 2006 04:51:40 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 101830 for review Message-ID: <200607180451.k6I4peiY003526@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=101830 Change 101830 by imp@imp_harmony on 2006/07/18 04:51:23 IFC @101829 Affected files ... .. //depot/projects/arm/src/sys/arm/arm/in_cksum.c#6 integrate .. //depot/projects/arm/src/sys/i386/i386/pmap.c#16 integrate .. //depot/projects/arm/src/sys/vm/uma_core.c#8 integrate Differences ... ==== //depot/projects/arm/src/sys/arm/arm/in_cksum.c#6 (text+ko) ==== @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -__FBSDID("$FreeBSD: src/sys/arm/arm/in_cksum.c,v 1.6 2006/03/09 23:33:59 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/in_cksum.c,v 1.7 2006/07/18 00:07:05 cognet Exp $"); #include <sys/param.h> #include <sys/mbuf.h> @@ -89,6 +89,17 @@ return (sum); } +static +uint64_t _do_cksum(void *addr, int len) +{ + uint64_t sum; + union q_util q_util; + + sum = do_cksum(addr, len); + REDUCE32; + return (sum); +} + u_short in_cksum_skip(struct mbuf *m, int len, int skip) { @@ -120,9 +131,9 @@ mlen = len; if ((clen ^ (int) addr) & 1) - sum += do_cksum(addr, mlen) << 8; + sum += _do_cksum(addr, mlen) << 8; else - sum += do_cksum(addr, mlen); + sum += _do_cksum(addr, mlen); clen += mlen; len -= mlen; ==== //depot/projects/arm/src/sys/i386/i386/pmap.c#16 (text+ko) ==== @@ -75,7 +75,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/i386/i386/pmap.c,v 1.569 2006/07/17 03:10:17 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/i386/pmap.c,v 1.570 2006/07/18 03:17:12 alc Exp $"); /* * Manages physical address maps. @@ -266,7 +266,7 @@ static void free_pv_entry(pmap_t pmap, pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t locked_pmap, int try); -static void pmap_clear_ptes(vm_page_t m, int bit); +static void pmap_clear_write(vm_page_t m); static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_t mpte); @@ -3064,55 +3064,42 @@ } /* - * Clear the given bit in each of the given page's ptes. The bit is - * expressed as a 32-bit mask. Consequently, if the pte is 64 bits in - * size, only a bit within the least significant 32 can be cleared. + * Clear the write and modified bits in each of the given page's mappings. */ static __inline void -pmap_clear_ptes(vm_page_t m, int bit) +pmap_clear_write(vm_page_t m) { pv_entry_t pv; pmap_t pmap; - pt_entry_t pbits, *pte; + pt_entry_t oldpte, *pte; - if ((m->flags & PG_FICTITIOUS) || - (bit == PG_RW && (m->flags & PG_WRITEABLE) == 0)) + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + if ((m->flags & PG_FICTITIOUS) != 0 || + (m->flags & PG_WRITEABLE) == 0) return; - sched_pin(); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); - /* - * Loop over all current mappings setting/clearing as appropos If - * setting RO do we need to clear the VAC? - */ TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { pmap = PV_PMAP(pv); PMAP_LOCK(pmap); pte = pmap_pte_quick(pmap, pv->pv_va); retry: - pbits = *pte; - if (pbits & bit) { - if (bit == PG_RW) { - /* - * Regardless of whether a pte is 32 or 64 bits - * in size, PG_RW and PG_M are among the least - * significant 32 bits. - */ - if (!atomic_cmpset_int((u_int *)pte, pbits, - pbits & ~(PG_RW | PG_M))) - goto retry; - if (pbits & PG_M) { - vm_page_dirty(m); - } - } else { - atomic_clear_int((u_int *)pte, bit); - } + oldpte = *pte; + if ((oldpte & PG_RW) != 0) { + /* + * Regardless of whether a pte is 32 or 64 bits + * in size, PG_RW and PG_M are among the least + * significant 32 bits. + */ + if (!atomic_cmpset_int((u_int *)pte, oldpte, + oldpte & ~(PG_RW | PG_M))) + goto retry; + if ((oldpte & PG_M) != 0) + vm_page_dirty(m); pmap_invalidate_page(pmap, pv->pv_va); } PMAP_UNLOCK(pmap); } - if (bit == PG_RW) - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_flag_clear(m, PG_WRITEABLE); sched_unpin(); } @@ -3126,7 +3113,7 @@ { if ((prot & VM_PROT_WRITE) == 0) { if (prot & (VM_PROT_READ | VM_PROT_EXECUTE)) { - pmap_clear_ptes(m, PG_RW); + pmap_clear_write(m); } else { pmap_remove_all(m); } @@ -3186,7 +3173,30 @@ void pmap_clear_modify(vm_page_t m) { - pmap_clear_ptes(m, PG_M); + pv_entry_t pv; + pmap_t pmap; + pt_entry_t *pte; + + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + if ((m->flags & PG_FICTITIOUS) != 0) + return; + sched_pin(); + TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { + pmap = PV_PMAP(pv); + PMAP_LOCK(pmap); + pte = pmap_pte_quick(pmap, pv->pv_va); + if ((*pte & PG_M) != 0) { + /* + * Regardless of whether a pte is 32 or 64 bits + * in size, PG_M is among the least significant + * 32 bits. + */ + atomic_clear_int((u_int *)pte, PG_M); + pmap_invalidate_page(pmap, pv->pv_va); + } + PMAP_UNLOCK(pmap); + } + sched_unpin(); } /* @@ -3197,7 +3207,30 @@ void pmap_clear_reference(vm_page_t m) { - pmap_clear_ptes(m, PG_A); + pv_entry_t pv; + pmap_t pmap; + pt_entry_t *pte; + + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + if ((m->flags & PG_FICTITIOUS) != 0) + return; + sched_pin(); + TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { + pmap = PV_PMAP(pv); + PMAP_LOCK(pmap); + pte = pmap_pte_quick(pmap, pv->pv_va); + if ((*pte & PG_A) != 0) { + /* + * Regardless of whether a pte is 32 or 64 bits + * in size, PG_A is among the least significant + * 32 bits. + */ + atomic_clear_int((u_int *)pte, PG_A); + pmap_invalidate_page(pmap, pv->pv_va); + } + PMAP_UNLOCK(pmap); + } + sched_unpin(); } /* ==== //depot/projects/arm/src/sys/vm/uma_core.c#8 (text+ko) ==== @@ -48,7 +48,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/vm/uma_core.c,v 1.138 2006/07/16 22:53:26 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/vm/uma_core.c,v 1.139 2006/07/18 01:13:18 rwatson Exp $"); /* I should really use ktr.. */ /* @@ -2768,6 +2768,7 @@ } } +#ifdef DDB /* * Generate statistics across both the zone and its per-cpu cache's. Return * desired statistics if the pointer is non-NULL for that statistic. @@ -2809,6 +2810,7 @@ if (freesp != NULL) *freesp = frees; } +#endif /* DDB */ static int sysctl_vm_zone_count(SYSCTL_HANDLER_ARGS)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607180451.k6I4peiY003526>