Skip to content

Add: tasklist_lock#1

Open
jqwang1992 wants to merge 1 commit intowangxiaoq:masterfrom
jqwang1992:master
Open

Add: tasklist_lock#1
jqwang1992 wants to merge 1 commit intowangxiaoq:masterfrom
jqwang1992:master

Conversation

@jqwang1992
Copy link
Copy Markdown

For_each_process() were called many times by other function of linux kernel and tasklist is often modifed, so we need lock to protect the tasklist. Tasklist_lock is the special lock to protect tasklist in linux kernel.

@wangxiaoq
Copy link
Copy Markdown
Owner

OK, I will merge it after test

@wangxiaoq
Copy link
Copy Markdown
Owner

When I compile it I got the following warning, please make sure you have test it before issue a PR.

make -C /lib/modules/uname -r/build M=/home/wangxq/dump-phys-addr modules
make[1]: Entering directory `/usr/src/linux-headers-4.4.0-31-generic'
CC [M] /home/wangxq/dump-phys-addr/dump-phys.o
Building modules, stage 2.
MODPOST 1 modules
**

WARNING: "tasklist_lock" [/home/wangxq/dump-phys-addr/dump-phys.ko] undefined!

**
CC /home/wangxq/dump-phys-addr/dump-phys.mod.o
LD [M] /home/wangxq/dump-phys-addr/dump-phys.ko
make[1]: Leaving directory `/usr/src/linux-headers-4.4.0-31-generic'

@jqwang1992
Copy link
Copy Markdown
Author

jqwang1992 commented Sep 30, 2017

Yes, I did, but it's need to EXPORT_SYMBOL(tasklist_lock). Here's why:

-What: remove EXPORT_SYMBOL(tasklist_lock)
-When: August 2006
-Files: kernel/fork.c
-Why: tasklist_lock protects the kernel internal task list. Modules have
no business looking at it, and all instances in drivers have been due
to use of too-lowlevel APIs. Having this symbol exported prevents
moving to more scalable locking schemes for the task list.
-Who: Christoph Hellwig hch@lst.de


https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?h=v4.4.89&id=c59923a15c12d2b3597af913bf234a0ef264a38b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants