Skip to content

Replacing PID bitmap implementation with IDR API

Gargi Sharma lkml 6 versions – Applied

Status from this message: [merged] pid-remove-pidhash.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest2 patches 14 repliesApplied 2/2
  2. v52 patches 1 replySuperseded
  3. v42 patches 10 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v32 patches1 replySuperseded
v22 patches23 repliesSuperseded
v14 patches13 repliesSuperseded

Changes in v6 from the cover letter

- Fix comment style inside alloc_pid.
- Move rcu lock before tasklist lock.
- Fix build error for upid.

Patches in v6 All 2 applied

#Subject and filesSizeRepliesApplied
1/2pid: Replace pid bitmap implementation with IDR APIarch/powerpc/platforms/cell/spufs/sched.c fs/proc/loadavg.c include/linux/pid_namespace.h +3 more+57 -20812 repliesApplied
2/2pid: Remove pidhasharch/ia64/kernel/asm-offsets.c include/linux/init_task.h include/linux/pid.h +5 more+18 -502 repliesApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchRik van RielTony Luck
1/2R-b
2/2R-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 0/2] Replacing PID bitmap implementation with IDR API

This patch series replaces kernel bitmap implementation of PID allocation
with IDR API. These patches are written to simplify the kernel by replacing custom code with calls to generic code.

The following are the stats for pid and pid_namespace object files before and after the replacement. There is a noteworthy change between the IDR and bitmap implementation.

Before
text data bss dec hex filename
8447 3894 64 12405 3075 kernel/pid.o
After
text data bss dec hex filename
3397 304 0 3701 e75 kernel/pid.o

Before
text data bss dec hex filename
5692 1842 192 7726 1e2e kernel/pid_namespace.o
After
text data bss dec hex filename
2854 216 16 3086 c0e kernel/pid_namespace.o

The following are the stats for ps, pstree and calling readdir on /proc for 10,000 processes.

ps:

        With IDR API    With bitmap
real    0m1.962s        0m2.319s
user    0m0.052s        0m0.060s
sys     0m0.392s        0m0.516s

pstree:

        With IDR API    With bitmap
real    0m1.062s        0m1.794s
user    0m0.536s        0m0.612s
sys     0m0.184s        0m0.264s

proc:

        With IDR API    With bitmap
real    0m0.073s        0m0.074s
user    0m0.004s        0m0.004s
sys     0m0.012s        0m0.016s

---
Changes in v6:
- Fix comment style inside alloc_pid.
- Move rcu lock before tasklist lock.
- Fix build error for upid.
Changes in v5:
- Add rcu lock while iterating over idr tree.
- Fix checkpatch issues.
Changes in v4:
- Make comments for alloc_pid clearer.
Changes in v3:
- Replace idr_next with idr_get_cursor().
- Correct pid_alloc so that find_pid_ns can't find not completely allocated pids.
Changes in v2:
- Removed redundant IDR function that was introduced in the previous patchset.
- Renamed PIDNS_HASH_ADDING
- Used idr_for_each_entry_continue()
- Used idr_find() to lookup pids

Gargi Sharma (2):
pid: Replace pid bitmap implementation with IDR API
pid: Remove pidhash

 arch/ia64/kernel/asm-offsets.c            |   4 +-
 arch/powerpc/platforms/cell/spufs/sched.c |   2 +-
 fs/proc/loadavg.c                         |   2 +-
 include/linux/init_task.h                 |   1 -
 include/linux/pid.h                       |   2 -
 include/linux/pid_namespace.h             |  18 +--
 init/main.c                               |   3 +-
 kernel/fork.c                             |   2 +-
 kernel/pid.c                              | 247 ++++++------------------------
 kernel/pid_namespace.c                    |  50 +++---
 10 files changed, 74 insertions(+), 257 deletions(-)
Signature · 1 line
2.7.4