Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107328539
D36218.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D36218.diff
View Options
diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -2462,14 +2462,6 @@
#define PC_FREEN 0xfffffffffffffffful
#define PC_FREEL ((1ul << (_NPCPV % 64)) - 1)
-#if _NPCM == 3
-#define PC_IS_FREE(pc) ((pc)->pc_map[0] == PC_FREEN && \
- (pc)->pc_map[1] == PC_FREEN && (pc)->pc_map[2] == PC_FREEL)
-#else
-#define PC_IS_FREE(pc) \
- (memcmp((pc)->pc_map, pc_freemask, sizeof(pc_freemask)) == 0)
-#endif
-
static const uint64_t pc_freemask[] = { PC_FREEN, PC_FREEN,
#if _NPCM > 3
PC_FREEN, PC_FREEN, PC_FREEN, PC_FREEN, PC_FREEN, PC_FREEN, PC_FREEN,
@@ -2489,6 +2481,15 @@
return (true);
}
+static __inline bool
+pc_is_free(struct pv_chunk *pc)
+{
+ for (u_int i = 0; i < _NPCM - 1; i++)
+ if (pc->pc_map[i] != PC_FREEN)
+ return (false);
+ return (pc->pc_map[_NPCM - 1] == PC_FREEL);
+}
+
#ifdef PV_STATS
static int pc_chunk_count, pc_chunk_allocs, pc_chunk_frees, pc_chunk_tryfail;
@@ -2653,7 +2654,7 @@
PV_STAT(atomic_add_int(&pv_entry_spare, freed));
PV_STAT(atomic_subtract_long(&pv_entry_count, freed));
TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
- if (PC_IS_FREE(pc)) {
+ if (pc_is_free(pc)) {
PV_STAT(atomic_subtract_int(&pv_entry_spare, _NPCPV));
PV_STAT(atomic_subtract_int(&pc_chunk_count, 1));
PV_STAT(atomic_add_int(&pc_chunk_frees, 1));
@@ -2722,7 +2723,7 @@
field = idx / 64;
bit = idx % 64;
pc->pc_map[field] |= 1ul << bit;
- if (!PC_IS_FREE(pc)) {
+ if (!pc_is_free(pc)) {
/* 98% of the time, pc is already at the head of the list. */
if (__predict_false(pc != TAILQ_FIRST(&pmap->pm_pvchunk))) {
TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 13, 1:48 PM (18 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15782754
Default Alt Text
D36218.diff (1 KB)
Attached To
Mode
D36218: arm64 pmap: Convert PC_IS_FREE into an inline function.
Attached
Detach File
Event Timeline
Log In to Comment