Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153944687
D6541.id16815.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D6541.id16815.diff
View Options
Index: sys/amd64/amd64/pmap.c
===================================================================
--- sys/amd64/amd64/pmap.c
+++ sys/amd64/amd64/pmap.c
@@ -104,6 +104,7 @@
#include "opt_vm.h"
#include <sys/param.h>
+#include <sys/bitstring.h>
#include <sys/bus.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@@ -585,7 +586,7 @@
static void free_pv_chunk(struct pv_chunk *pc);
static void free_pv_entry(pmap_t pmap, pv_entry_t pv);
static pv_entry_t get_pv_entry(pmap_t pmap, struct rwlock **lockp);
-static int popcnt_pc_map_elem_pq(uint64_t elem);
+static int popcnt_pc_map_pq(uint64_t *map);
static vm_page_t reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **lockp);
static void reserve_pv_entries(pmap_t pmap, int needed,
struct rwlock **lockp);
@@ -3126,7 +3127,7 @@
}
/*
- * Returns the number of one bits within the given PV chunk map element.
+ * Returns the number of one bits within the given PV chunk map.
*
* The erratas for Intel processors state that "POPCNT Instruction May
* Take Longer to Execute Than Expected". It is believed that the
@@ -3142,12 +3143,15 @@
* 6th Gen Core: SKL029
*/
static int
-popcnt_pc_map_elem_pq(uint64_t elem)
+popcnt_pc_map_pq(uint64_t *map)
{
- u_long result;
+ u_long result, tmp;
- __asm __volatile("xorl %k0,%k0;popcntq %1,%0"
- : "=&r" (result) : "rm" (elem));
+ __asm __volatile("xorl %k0,%k0;popcntq %2,%0;"
+ "xorl %k1,%k1;popcntq %3,%1;addl %k1,%k0;"
+ "xorl %k1,%k1;popcntq %4,%1;addl %k1,%k0"
+ : "=&r" (result), "=&r" (tmp)
+ : "m" (map[0]), "m" (map[1]), "m" (map[2]));
return (result);
}
@@ -3179,17 +3183,12 @@
avail = 0;
TAILQ_FOREACH(pc, &pmap->pm_pvchunk, pc_list) {
#ifndef __POPCNT__
- if ((cpu_feature2 & CPUID2_POPCNT) == 0) {
- free = bitcount64(pc->pc_map[0]);
- free += bitcount64(pc->pc_map[1]);
- free += bitcount64(pc->pc_map[2]);
- } else
+ if ((cpu_feature2 & CPUID2_POPCNT) == 0)
+ bit_count((bitstr_t *)pc->pc_map, 0,
+ sizeof(pc->pc_map) * NBBY, &free);
+ else
#endif
- {
- free = popcnt_pc_map_elem_pq(pc->pc_map[0]);
- free += popcnt_pc_map_elem_pq(pc->pc_map[1]);
- free += popcnt_pc_map_elem_pq(pc->pc_map[2]);
- }
+ free = popcnt_pc_map_pq(pc->pc_map);
if (free == 0)
break;
avail += free;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 26, 12:11 AM (14 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32149570
Default Alt Text
D6541.id16815.diff (2 KB)
Attached To
Mode
D6541: Optimize reserve_pv_entries() in sys/amd64/amd64/pmap.c
Attached
Detach File
Event Timeline
Log In to Comment