Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F163389489
D18054.id.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
D18054.id.diff
View Options
Index: head/sys/kern/subr_unit.c
===================================================================
--- head/sys/kern/subr_unit.c
+++ head/sys/kern/subr_unit.c
@@ -98,6 +98,19 @@
MTX_SYSINIT(unit, &unitmtx, "unit# allocation", MTX_DEF);
+#ifdef UNR64_LOCKED
+uint64_t
+alloc_unr64(struct unrhdr64 *unr64)
+{
+ uint64_t item;
+
+ mtx_lock(&unitmtx);
+ item = unr64->counter++;
+ mtx_unlock(&unitmtx);
+ return (item);
+}
+#endif
+
#else /* ...USERLAND */
#include <bitstring.h>
Index: head/sys/sys/systm.h
===================================================================
--- head/sys/sys/systm.h
+++ head/sys/sys/systm.h
@@ -523,6 +523,32 @@
int alloc_unrl(struct unrhdr *uh);
void free_unr(struct unrhdr *uh, u_int item);
+#if defined(__mips__) || defined(__powerpc__)
+#define UNR64_LOCKED
+#endif
+
+struct unrhdr64 {
+ uint64_t counter;
+};
+
+static __inline void
+new_unrhdr64(struct unrhdr64 *unr64, uint64_t low)
+{
+
+ unr64->counter = low;
+}
+
+#ifdef UNR64_LOCKED
+uint64_t alloc_unr64(struct unrhdr64 *);
+#else
+static __inline uint64_t
+alloc_unr64(struct unrhdr64 *unr64)
+{
+
+ return (atomic_fetchadd_64(&unr64->counter, 1));
+}
+#endif
+
void intr_prof_stack_use(struct thread *td, struct trapframe *frame);
void counted_warning(unsigned *counter, const char *msg);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 23, 6:48 PM (3 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35411679
Default Alt Text
D18054.id.diff (1 KB)
Attached To
Mode
D18054: Implement unr64
Attached
Detach File
Event Timeline
Log In to Comment