Page MenuHomeFreeBSD

D32580.diff
No OneTemporary

D32580.diff

diff --git a/sys/arm/include/proc.h b/sys/arm/include/proc.h
--- a/sys/arm/include/proc.h
+++ b/sys/arm/include/proc.h
@@ -72,4 +72,15 @@
register_t args[MAXARGS];
} __aligned(8);
+#ifdef _KERNEL
+#include <machine/pcb.h>
+
+/* Get the current kernel thread stack usage. */
+#define GET_STACK_USAGE(total, used) do { \
+ struct thread *td = curthread; \
+ (total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \
+ (used) = td->td_kstack + (total) - (vm_offset_t)&td; \
+} while (0)
+
+#endif /* _KERNEL */
#endif /* !_MACHINE_PROC_H_ */
diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c
--- a/sys/geom/geom_io.c
+++ b/sys/geom/geom_io.c
@@ -559,7 +559,6 @@
atomic_add_int(&cp->nstart, 1);
#endif
-#ifdef GET_STACK_USAGE
direct = (cp->flags & G_CF_DIRECT_SEND) != 0 &&
(pp->flags & G_PF_DIRECT_RECEIVE) != 0 &&
!g_is_geom_thread(curthread) &&
@@ -573,9 +572,6 @@
if (su * 2 > st)
direct = 0;
}
-#else
- direct = 0;
-#endif
if (direct) {
error = g_io_check(bp);
@@ -655,7 +651,6 @@
bp->bio_bcount = bp->bio_length;
bp->bio_resid = bp->bio_bcount - bp->bio_completed;
-#ifdef GET_STACK_USAGE
direct = (pp->flags & G_PF_DIRECT_SEND) &&
(cp->flags & G_CF_DIRECT_RECEIVE) &&
!g_is_geom_thread(curthread);
@@ -666,9 +661,6 @@
if (su * 2 > st)
direct = 0;
}
-#else
- direct = 0;
-#endif
/*
* The statistics collection is lockless, as such, but we
diff --git a/sys/mips/include/proc.h b/sys/mips/include/proc.h
--- a/sys/mips/include/proc.h
+++ b/sys/mips/include/proc.h
@@ -96,4 +96,15 @@
#define KINFO_PROC_SIZE 816
#endif
+#ifdef _KERNEL
+#include <machine/pcb.h>
+
+/* Get the current kernel thread stack usage. */
+#define GET_STACK_USAGE(total, used) do { \
+ struct thread *td = curthread; \
+ (total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \
+ (used) = td->td_kstack + (total) - (vm_offset_t)&td; \
+} while (0)
+
+#endif /* _KERNEL */
#endif /* !_MACHINE_PROC_H_ */
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c
--- a/sys/netgraph/ng_base.c
+++ b/sys/netgraph/ng_base.c
@@ -2281,7 +2281,7 @@
queue = 1;
} else {
queue = 0;
-#ifdef GET_STACK_USAGE
+
/*
* Most of netgraph nodes have small stack consumption and
* for them 25% of free stack space is more than enough.
@@ -2296,7 +2296,6 @@
((node->nd_flags & NGF_HI_STACK) || (hook &&
(hook->hk_flags & HK_HI_STACK)))))
queue = 1;
-#endif
}
if (queue) {
diff --git a/sys/riscv/include/proc.h b/sys/riscv/include/proc.h
--- a/sys/riscv/include/proc.h
+++ b/sys/riscv/include/proc.h
@@ -53,4 +53,15 @@
register_t args[MAXARGS];
};
+#ifdef _KERNEL
+#include <machine/pcb.h>
+
+/* Get the current kernel thread stack usage. */
+#define GET_STACK_USAGE(total, used) do { \
+ struct thread *td = curthread; \
+ (total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \
+ (used) = td->td_kstack + (total) - (vm_offset_t)&td; \
+} while (0)
+
+#endif /* _KERNEL */
#endif /* !_MACHINE_PROC_H_ */

File Metadata

Mime Type
text/plain
Expires
Sat, Jan 11, 8:32 PM (17 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15757558
Default Alt Text
D32580.diff (2 KB)

Event Timeline