proc.h & time to re-build kernel

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

proc.h & time to re-build kernel

Martin Pieuchot
During n2k20 we asked ourself why touching a header makes us rebuild a lot
of the kernel again.  New year or new cycle maybe, that's time for a new
round of cleanup ;o)

Today I figured out why when I touch <sys/proc.h> I have to rebuild too
much.  I came up with two cleanups, diff below is the first one.

<sys/kthread.h> is the only sys/ header including <sys/proc.h>.  It is
not always needed and do not necessarily require including <sys/proc.h>.

The diff below removes it from the places where it isn't needed, replaces
it with <sys/proc.h> when that's what the file need, adds a forward
definition when it's enough and adds it in the places where a `proc' is
dereferenced.

Compiled for all affected architectures.

Ok?

Index: arch/armv7/omap/ommmc.c
===================================================================
RCS file: /cvs/src/sys/arch/armv7/omap/ommmc.c,v
retrieving revision 1.32
diff -u -p -r1.32 ommmc.c
--- arch/armv7/omap/ommmc.c 13 Jan 2020 13:30:42 -0000 1.32
+++ arch/armv7/omap/ommmc.c 14 Feb 2020 18:47:00 -0000
@@ -23,7 +23,6 @@
 #include <sys/param.h>
 #include <sys/device.h>
 #include <sys/kernel.h>
-#include <sys/kthread.h>
 #include <sys/malloc.h>
 #include <sys/systm.h>
 #include <machine/bus.h>
Index: arch/sparc64/dev/stp_sbus.c
===================================================================
RCS file: /cvs/src/sys/arch/sparc64/dev/stp_sbus.c,v
retrieving revision 1.10
diff -u -p -r1.10 stp_sbus.c
--- arch/sparc64/dev/stp_sbus.c 26 Jun 2008 05:42:13 -0000 1.10
+++ arch/sparc64/dev/stp_sbus.c 14 Feb 2020 18:47:29 -0000
@@ -42,7 +42,6 @@
 #include <sys/extent.h>
 #include <sys/proc.h>
 #include <sys/kernel.h>
-#include <sys/kthread.h>
 #include <sys/device.h>
 
 #include <dev/pcmcia/pcmciareg.h>
Index: dev/acpi/dwiic_acpi.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/dwiic_acpi.c,v
retrieving revision 1.12
diff -u -p -r1.12 dwiic_acpi.c
--- dev/acpi/dwiic_acpi.c 4 Aug 2019 15:44:17 -0000 1.12
+++ dev/acpi/dwiic_acpi.c 14 Feb 2020 18:48:05 -0000
@@ -20,7 +20,6 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
-#include <sys/kthread.h>
 
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
Index: dev/cardbus/cardslot.c
===================================================================
RCS file: /cvs/src/sys/dev/cardbus/cardslot.c,v
retrieving revision 1.21
diff -u -p -r1.21 cardslot.c
--- dev/cardbus/cardslot.c 15 Sep 2016 02:00:17 -0000 1.21
+++ dev/cardbus/cardslot.c 14 Feb 2020 18:48:10 -0000
@@ -34,7 +34,6 @@
 #include <sys/malloc.h>
 #include <sys/kernel.h>
 #include <sys/syslog.h>
-#include <sys/kthread.h>
 #include <sys/pool.h>
 #include <sys/task.h>
 
Index: dev/fdt/imxesdhc.c
===================================================================
RCS file: /cvs/src/sys/dev/fdt/imxesdhc.c,v
retrieving revision 1.12
diff -u -p -r1.12 imxesdhc.c
--- dev/fdt/imxesdhc.c 13 Jan 2020 13:30:00 -0000 1.12
+++ dev/fdt/imxesdhc.c 14 Feb 2020 18:51:33 -0000
@@ -22,7 +22,6 @@
 #include <sys/param.h>
 #include <sys/device.h>
 #include <sys/kernel.h>
-#include <sys/kthread.h>
 #include <sys/malloc.h>
 #include <sys/systm.h>
 #include <machine/bus.h>
Index: dev/ic/dwiic.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/dwiic.c,v
retrieving revision 1.9
diff -u -p -r1.9 dwiic.c
--- dev/ic/dwiic.c 11 Jan 2020 20:07:40 -0000 1.9
+++ dev/ic/dwiic.c 14 Feb 2020 18:48:30 -0000
@@ -20,7 +20,6 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
-#include <sys/kthread.h>
 
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
Index: dev/ic/dwiicvar.h
===================================================================
RCS file: /cvs/src/sys/dev/ic/dwiicvar.h,v
retrieving revision 1.3
diff -u -p -r1.3 dwiicvar.h
--- dev/ic/dwiicvar.h 16 Mar 2019 02:40:43 -0000 1.3
+++ dev/ic/dwiicvar.h 14 Feb 2020 18:48:43 -0000
@@ -20,7 +20,6 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
-#include <sys/kthread.h>
 
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
Index: dev/pci/drm/i915/intel_breadcrumbs.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/i915/intel_breadcrumbs.c,v
retrieving revision 1.5
diff -u -p -r1.5 intel_breadcrumbs.c
--- dev/pci/drm/i915/intel_breadcrumbs.c 30 Jan 2020 08:51:27 -0000 1.5
+++ dev/pci/drm/i915/intel_breadcrumbs.c 14 Feb 2020 18:50:59 -0000
@@ -28,7 +28,6 @@
 #else
 #include <sys/types.h>
 #include <sys/param.h>
-#include <sys/kthread.h>
 #endif
 
 #include "i915_drv.h"
Index: dev/pci/drm/include/drm/drmP.h
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/include/drm/drmP.h,v
retrieving revision 1.5
diff -u -p -r1.5 drmP.h
--- dev/pci/drm/include/drm/drmP.h 18 Aug 2019 13:11:47 -0000 1.5
+++ dev/pci/drm/include/drm/drmP.h 14 Feb 2020 19:01:02 -0000
@@ -45,7 +45,6 @@
 #include <sys/pool.h>
 #include <sys/kernel.h>
 #include <sys/systm.h>
-#include <sys/proc.h>
 #include <sys/conf.h>
 #include <sys/mutex.h>
 #include <sys/tree.h>
Index: dev/pci/drm/include/linux/sched.h
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/include/linux/sched.h,v
retrieving revision 1.1
diff -u -p -r1.1 sched.h
--- dev/pci/drm/include/linux/sched.h 14 Apr 2019 10:14:53 -0000 1.1
+++ dev/pci/drm/include/linux/sched.h 14 Feb 2020 19:01:41 -0000
@@ -23,7 +23,6 @@
 #include <sys/kernel.h>
 #include <sys/stdint.h>
 #include <sys/mutex.h>
-#include <sys/proc.h>
 #include <linux/wait.h>
 #include <linux/hrtimer.h>
 
@@ -47,6 +46,7 @@ long schedule_timeout(long);
 
 #define io_schedule_timeout(x) schedule_timeout(x)
 
+struct proc;
 int wake_up_process(struct proc *p);
 
 #endif
Index: dev/pci/drm/scheduler/gpu_scheduler.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/scheduler/gpu_scheduler.c,v
retrieving revision 1.4
diff -u -p -r1.4 gpu_scheduler.c
--- dev/pci/drm/scheduler/gpu_scheduler.c 11 Dec 2019 07:30:09 -0000 1.4
+++ dev/pci/drm/scheduler/gpu_scheduler.c 14 Feb 2020 18:50:27 -0000
@@ -57,8 +57,6 @@
 #define CREATE_TRACE_POINTS
 #include "gpu_scheduler_trace.h"
 
-#include <sys/kthread.h>
-
 #define to_drm_sched_job(sched_job) \
  container_of((sched_job), struct drm_sched_job, queue_node)
 
Index: dev/pci/dwiic_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/dwiic_pci.c,v
retrieving revision 1.9
diff -u -p -r1.9 dwiic_pci.c
--- dev/pci/dwiic_pci.c 31 Jul 2019 16:04:16 -0000 1.9
+++ dev/pci/dwiic_pci.c 14 Feb 2020 18:51:07 -0000
@@ -21,7 +21,6 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
-#include <sys/kthread.h>
 
 #include <dev/pci/pcidevs.h>
 #include <dev/pci/pcireg.h>
Index: kern/kern_timeout.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_timeout.c,v
retrieving revision 1.71
diff -u -p -r1.71 kern_timeout.c
--- kern/kern_timeout.c 13 Jan 2020 09:51:52 -0000 1.71
+++ kern/kern_timeout.c 14 Feb 2020 18:44:51 -0000
@@ -28,6 +28,7 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kthread.h>
+#include <sys/proc.h>
 #include <sys/timeout.h>
 #include <sys/mutex.h>
 #include <sys/kernel.h>
Index: net/pf_ioctl.c
===================================================================
RCS file: /cvs/src/sys/net/pf_ioctl.c,v
retrieving revision 1.348
diff -u -p -r1.348 pf_ioctl.c
--- net/pf_ioctl.c 8 Jan 2020 21:48:59 -0000 1.348
+++ net/pf_ioctl.c 14 Feb 2020 18:53:16 -0000
@@ -51,7 +51,7 @@
 #include <sys/timeout.h>
 #include <sys/pool.h>
 #include <sys/malloc.h>
-#include <sys/kthread.h>
+#include <sys/proc.h>
 #include <sys/rwlock.h>
 #include <sys/syslog.h>
 #include <uvm/uvm_extern.h>
Index: sys/kthread.h
===================================================================
RCS file: /cvs/src/sys/sys/kthread.h,v
retrieving revision 1.6
diff -u -p -r1.6 kthread.h
--- sys/kthread.h 18 Nov 2013 20:21:51 -0000 1.6
+++ sys/kthread.h 14 Feb 2020 18:38:56 -0000
@@ -39,8 +39,6 @@
  */
 
 #ifdef _KERNEL
-#include <sys/proc.h> /* struct proc, tsleep(), wakeup() */
-
 int kthread_create(void (*)(void *), void *, struct proc **,
     const char *);
 void kthread_create_deferred(void (*)(void *), void *);
Index: ufs/mfs/mfs_vfsops.c
===================================================================
RCS file: /cvs/src/sys/ufs/mfs/mfs_vfsops.c,v
retrieving revision 1.57
diff -u -p -r1.57 mfs_vfsops.c
--- ufs/mfs/mfs_vfsops.c 26 Dec 2019 13:28:50 -0000 1.57
+++ ufs/mfs/mfs_vfsops.c 14 Feb 2020 18:52:30 -0000
@@ -41,7 +41,6 @@
 #include <sys/signalvar.h>
 #include <sys/vnode.h>
 #include <sys/malloc.h>
-#include <sys/kthread.h>
 
 #include <ufs/ufs/quota.h>
 #include <ufs/ufs/inode.h>
Index: uvm/uvm_km.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_km.c,v
retrieving revision 1.135
diff -u -p -r1.135 uvm_km.c
--- uvm/uvm_km.c 30 Dec 2019 23:58:38 -0000 1.135
+++ uvm/uvm_km.c 14 Feb 2020 18:57:15 -0000
@@ -131,6 +131,7 @@
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/proc.h>
 #include <sys/kthread.h>
 #include <uvm/uvm.h>
 
Index: uvm/uvm_pmemrange.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_pmemrange.c,v
retrieving revision 1.58
diff -u -p -r1.58 uvm_pmemrange.c
--- uvm/uvm_pmemrange.c 1 Jan 2020 01:50:00 -0000 1.58
+++ uvm/uvm_pmemrange.c 14 Feb 2020 18:57:16 -0000
@@ -21,7 +21,7 @@
 #include <uvm/uvm.h>
 #include <sys/malloc.h>
 #include <sys/kernel.h>
-#include <sys/kthread.h>
+#include <sys/proc.h>
 #include <sys/mount.h>
 
 /*