Re: Redundant uses of might_sleep_if()

From: Andrew Morton
Date: Fri Jan 30 2004 - 15:18:30 EST


ioana alexandrescu <ioanamitu@xxxxxxxxx> wrote:
>
> In kernel 2.6.1 it appears that the only necessary
> uses of might_sleep_if()are in __alloc_pages(), and
> perhaps, in cache_alloc_debugcheck_before() (see
> notes).
>
> Other uses of might_sleep_if() appear to be redundant:
>
> Pte_chain_alloc()-->might_sleep_if(), but also
> Pte_chain_alloc-->kmem_cache_alloc
> -->__cache_alloc -->__cache_alloc()
> -->cache_alloc_debugcheck_before()
> -->might_sleep_if()
>
> skb_share_check()-->might_sleep_if(), but also
> skb_share_check()-->skb_clone()
> -->kmem_cache_alloc()[as above]
>
> skb_unshare()-->might_sleep_if(), but also
> skb_unshare()-->skb_copy()
> -->kmem_cache_alloc()[as above]
>
> Other paths through skb_unshare, same result.
>
>
> QUERY: Should these redundant uses be patched out?

Nope.

Take the case of pte_chain_alloc(). Most of the time, it won't call
kmem_cache_alloc() at all. But sometimes it will. But we want to run the
might_sleep() check *every* time someone calls pte_chain_alloc(), not just
some of the times.

-
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/