ptab_end: redo the various process table scans
authorAlan Cox <alan@linux.intel.com>
Sat, 3 Jan 2015 15:41:36 +0000 (15:41 +0000)
committerAlan Cox <alan@linux.intel.com>
Sat, 3 Jan 2015 15:41:36 +0000 (15:41 +0000)
commit310581f1bb278baad6aaa9f4ce6c8108ea1ed4e1
treed61b25b72f3d49598ed7d511fa3ac7ab7f9c3476
parent152a6824c67b8f2ac6c0b7c92d4a9809c6d3bafc
ptab_end: redo the various process table scans

Currently we do a compare with &ptab[maxproc], which generates a pile of
maths to scale maxproc each time around the loop. This is *silly* and its
repeated in various places where it takes space, time and registers.

Instead in start.c evaluate &ptab[maxproc] once after maxproc is computed
and save it as ptab_end. Our comparisons now now don't do the math. This
saves us 180 bytes, or nearly half the cost of adding flock support.
Kernel/include/kdata.h
Kernel/kdata.c
Kernel/process.c
Kernel/start.c
Kernel/swap.c
Kernel/syscall_proc.c