From: Peter Williams <pwil3058@bigpond.net.au>
To: Matt Helsley <matthltc@us.ibm.com>
Cc: Andrew Morton <akpm@osdl.org>,
nagar@watson.ibm.com, sekharan@us.ibm.com, jtk@us.ibm.com,
balbir@in.ibm.com, jes@sgi.com, linux-kernel@vger.kernel.org,
stern@rowland.harvard.edu, lse-tech@lists.sourceforge.net
Subject: Re: [Lse-tech] [PATCH 09/11] Task watchers: Add support for per-task watchers
Date: Wed, 21 Jun 2006 23:01:05 +1000 [thread overview]
Message-ID: <44994311.5030707@bigpond.net.au> (raw)
In-Reply-To: <4498A728.207@bigpond.net.au>
Peter Williams wrote:
> Andrew Morton wrote:
>> On Tue, 20 Jun 2006 18:20:48 -0700
>> Matt Helsley <matthltc@us.ibm.com> wrote:
>>
>>>>>>> +static inline int notify_per_task_watchers(unsigned int val,
>>>>>>> + struct task_struct *task)
>>>>>>> +{
>>>>>>> + if (get_watch_event(val) != WATCH_TASK_INIT)
>>>>>>> + return raw_notifier_call_chain(&task->notify, val, task);
>>>>>>> + RAW_INIT_NOTIFIER_HEAD(&task->notify);
>>>>>>> + if (task->real_parent)
>>>>>>> + return raw_notifier_call_chain(&task->real_parent->notify,
>>>>>>> + val, task);
>>>>>>> +}
>>>>>> It's possible for this task to exit without returning a result.
>>>>> Assuming you meant s/task/function/:
>>>>>
>>>>> In the common case this will return a result because most tasks
>>>>> have a
>>>>> real parent. The only exception should be the init task. However, the
>>>>> init task does not "fork" from another task so this function will
>>>>> never
>>>>> get called with WATCH_TASK_INIT and the init task.
>>>>>
>>>>> This means that if one wants to use per-task watchers to
>>>>> associate data
>>>>> and a function call with *every* task, special care will need to be
>>>>> taken to register with the init task.
>>>> no......
>>> I've been looking through the source and, from what I can see,
>>> the end
>>> of the function is not reachable. I think I need to add:
>>>
>>> notify_watchers(WATCH_TASK_INIT, &init_task);
>>>
>>> to make this into an applicable warning.
>>
>> If the end of the function isn't reachable then the
>> `if (task->real_parent)' can simply be removed.
>
> Perhaps with a comment to say that it's safe (and why) to dereference
> task->real_parent to help code reviewers?
Now that I understand this code better, I'm at a loss to understand why
you're calling the parent with the notifier. I can't think of any
circumstances where this would be useful.
Peter
--
Peter Williams pwil3058@bigpond.net.au
"Learning, n. The kind of ignorance distinguishing the studious."
-- Ambrose Bierce
next prev parent reply other threads:[~2006-06-21 13:01 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20060613235122.130021000@localhost.localdomain>
2006-06-13 23:53 ` [PATCH 01/11] Task watchers: Task Watchers Matt Helsley
2006-06-14 0:19 ` Chase Venters
2006-06-14 0:55 ` Matt Helsley
2006-06-13 23:54 ` [PATCH 02/11] Task watchers: Register process events task watcher Matt Helsley
2006-06-14 0:39 ` Chase Venters
2006-06-14 0:52 ` Matt Helsley
2006-06-13 23:54 ` [PATCH 03/11] Task watchers: Refactor process events Matt Helsley
2006-06-14 0:43 ` Chase Venters
2006-06-14 1:11 ` Matt Helsley
2006-06-14 8:09 ` Chase Venters
2006-06-13 23:54 ` [PATCH 04/11] Task watchers: Make process events configurable as a module Matt Helsley
2006-06-14 0:54 ` Chase Venters
2006-06-14 1:18 ` [Lse-tech] " Matt Helsley
2006-06-13 23:54 ` [PATCH 05/11] Task watchers: Allow task watchers to block Matt Helsley
2006-06-13 23:54 ` [PATCH 06/11] Task watchers: Register audit task watcher Matt Helsley
2006-06-14 14:46 ` Alexander Viro
2006-06-14 23:28 ` Matt Helsley
2006-06-13 23:54 ` [PATCH 07/11] Task watchers: Register per-task delay accounting " Matt Helsley
2006-06-14 3:31 ` Shailabh Nagar
2006-06-14 22:52 ` Matt Helsley
2006-06-13 23:54 ` [PATCH 08/11] Task watchers: Register profile as a " Matt Helsley
2006-06-14 0:59 ` Chase Venters
2006-06-14 1:16 ` [Lse-tech] " Matt Helsley
2006-06-13 23:55 ` [PATCH 09/11] Task watchers: Add support for per-task watchers Matt Helsley
2006-06-20 5:28 ` Peter Williams
2006-06-20 22:56 ` [Lse-tech] " Matt Helsley
2006-06-20 23:15 ` Andrew Morton
2006-06-20 23:23 ` Peter Williams
2006-06-21 1:20 ` Matt Helsley
2006-06-21 1:46 ` Andrew Morton
2006-06-21 1:55 ` Peter Williams
2006-06-21 13:01 ` Peter Williams [this message]
2006-06-21 13:23 ` Peter Williams
2006-06-21 2:28 ` Matt Helsley
2006-06-20 23:21 ` Peter Williams
2006-06-13 23:55 ` [PATCH 10/11] Task watchers: Register semundo task watcher Matt Helsley
2006-06-13 23:55 ` [PATCH 11/11] Task watchers: Register per-task semundo watcher Matt Helsley
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=44994311.5030707@bigpond.net.au \
--to=pwil3058@bigpond.net.au \
--cc=akpm@osdl.org \
--cc=balbir@in.ibm.com \
--cc=jes@sgi.com \
--cc=jtk@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lse-tech@lists.sourceforge.net \
--cc=matthltc@us.ibm.com \
--cc=nagar@watson.ibm.com \
--cc=sekharan@us.ibm.com \
--cc=stern@rowland.harvard.edu \
/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