From: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
To: torvalds@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: [PATCH 1/5] kernel/exit.c: Use list_for_each_entry(_safe) instead of list_for_each(_safe)
Date: Sun, 22 Jul 2007 20:49:13 +0200 [thread overview]
Message-ID: <20070722184913.GG27415@traven> (raw)
In-Reply-To: <20070722184202.GF27415@traven>
kernel/exit.c: Convert list_for_each(_safe) to
list_for_each_entry(_safe) in forget_original_parent(), exit_notify()
and do_wait()
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
--
diff --git a/kernel/exit.c b/kernel/exit.c
index ca6a11b..ac84684 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -680,8 +680,7 @@ reparent_thread(struct task_struct *p, struct task_struct *father, int traced)
static void
forget_original_parent(struct task_struct *father, struct list_head *to_release)
{
- struct task_struct *p, *reaper = father;
- struct list_head *_p, *_n;
+ struct task_struct *p, *n, *reaper = father;
do {
reaper = next_thread(reaper);
@@ -699,9 +698,8 @@ forget_original_parent(struct task_struct *father, struct list_head *to_release)
*
* Search them and reparent children.
*/
- list_for_each_safe(_p, _n, &father->children) {
+ list_for_each_entry_safe(p, n, &father->children, sibling) {
int ptrace;
- p = list_entry(_p, struct task_struct, sibling);
ptrace = p->ptrace;
@@ -729,8 +727,7 @@ forget_original_parent(struct task_struct *father, struct list_head *to_release)
if (unlikely(ptrace && p->exit_state == EXIT_ZOMBIE && p->exit_signal == -1))
list_add(&p->ptrace_list, to_release);
}
- list_for_each_safe(_p, _n, &father->ptrace_children) {
- p = list_entry(_p, struct task_struct, ptrace_list);
+ list_for_each_entry_safe(p, n, &father->ptrace_children, ptrace_list) {
choose_new_parent(p, reaper);
reparent_thread(p, father, 1);
}
@@ -1502,12 +1499,9 @@ repeat:
tsk = current;
do {
struct task_struct *p;
- struct list_head *_p;
int ret;
- list_for_each(_p,&tsk->children) {
- p = list_entry(_p, struct task_struct, sibling);
-
+ list_for_each_entry(p, &tsk->children, sibling) {
ret = eligible_child(pid, options, p);
if (!ret)
continue;
@@ -1589,9 +1583,8 @@ check_continued:
}
}
if (!flag) {
- list_for_each(_p, &tsk->ptrace_children) {
- p = list_entry(_p, struct task_struct,
- ptrace_list);
+ list_for_each_entry(p, &tsk->ptrace_children,
+ ptrace_list) {
if (!eligible_child(pid, options, p))
continue;
flag = 1;
--
Matthias Kaehlcke
Linux Application Developer
Barcelona
If liberty means anything at all, it means the
right to tell people what they do not want to hear
(George Orwell)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
next prev parent reply other threads:[~2007-07-22 18:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-22 18:42 [PATCH 0/5] Use list_for_each_entry(_safe) instead of list_for_each(_safe) Matthias Kaehlcke
2007-07-22 18:49 ` Matthias Kaehlcke [this message]
2007-07-22 18:51 ` [PATCH 2/5] kernel/time/clocksource.c: Use list_for_each_entry instead of list_for_each Matthias Kaehlcke
2007-07-22 18:52 ` [PATCH 3/5] kernel/user.c: " Matthias Kaehlcke
2007-07-22 18:54 ` [PATCH 4/5] mm/oom_kill.c: " Matthias Kaehlcke
2007-07-22 18:56 ` [PATCH 5/5] mm/page_alloc.c: " Matthias Kaehlcke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070722184913.GG27415@traven \
--to=matthias.kaehlcke@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox