Re: 2.6.21-rc suspend regression: sysfs deadlock

From: Linus Torvalds
Date: Thu Mar 15 2007 - 12:52:40 EST




On Thu, 15 Mar 2007, Hugh Dickins wrote:
>
> sysfs_access_in_other_task() left me wondering what this "other" task
> was, and what kind of "access" it's trying to get - or is the calling
> task the other, and it's trying to access something it wouldn't
> directly have access to?

For naming clashes, I'd suggest:

- try to name according to *why* something is done, not necessarily what
it does.

For example, is it really in "another task"? Maybe it's just an
on-demand thread of the same task? Do you actually care how the
deferred work is done?

- avoid being vague. I agree with not liking the name much, and the
"other" thing bothers me. Like Hugh, it makes me ask "_What_ other
task?"

So I would suggest not concentrating on some implementation issue, but on
the reason why you need it in the first place. Namely that you want to
defer the actual action to avoid deadlock due to recursive locking. So
that "why do I actually do this" thing implies something like
"sysfs_store_async()" or "sysfs_store_deferred()" or maybe actually
concentrate on the locking angle and say something like
"sysfs_store_needs_to_reacquire_lock()".

(That last one wasn't really serious - it's too long and cumbersome, but
it's an example of not caring _how_ you do it, just abotu what you want
done).

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/