Re: 2.6.18-rc1-mm2

Dave Jones
2006-07-15T06:04:19Z

On Fri, Jul 14, 2006 at 10:40:01PM -0700, David Miller wrote:
> From: Herbert Xu <herbert@gondor.apana.org.au>
> Date: Sat, 15 Jul 2006 11:06:45 +1000
>
> > - __ret; \
> > + unlikely(__ret); \
>
> Wouldn't it be cleaner to wrap this unlikely around
> the top-level "({ })"? When it sits on a line by
> itself it looks strange, that much is true :)
>
> Actually, the last time I saw a construct like this
> it was a bug, someone was doing:
>
> return unlikely(someval);
>
> which turned someval into a boolean, even though what
> was intended was that the full value was returned.

Ick, nasty. Seems there's quite a few instances of that construct around.

arch/frv/kernel/gdb-stub.c: return likely(!brr);
arch/frv/kernel/gdb-stub.c: return likely(!brr);
arch/frv/kernel/gdb-stub.c: return likely(!brr);
arch/frv/kernel/gdb-stub.c: return likely(!brr);
arch/frv/kernel/gdb-stub.c: return likely(!brr);
arch/frv/kernel/gdb-stub.c: return likely(!brr);
net/sched/em_cmp.c: return unlikely(cmp->flags & TCF_EM_CMP_TRANS);
net/dccp/options.c: return likely(ndp <= 0xFF) ? 1 : ndp <= 0xFFFF ? 2 : 3;
fs/hugetlbfs/inode.c: return likely(capable(CAP_IPC_LOCK) ||
fs/hugetlbfs/inode.c: return likely(capable(CAP_IPC_LOCK) ||
include/linux/seccomp.h: return unlikely(test_ti_thread_flag(ti, TIF_SECCOMP));
include/linux/ipv6.h: return likely(sk->sk_state != TCP_TIME_WAIT) ?
include/linux/ipv6.h: return likely(sk->sk_state != TCP_TIME_WAIT) ?
include/linux/tracehook.h: return unlikely(p->utrace != NULL);
include/linux/tracehook.h: return unlikely(tsk->utrace_flags & UTRACE_ACTION_QUIESCE);
include/linux/swapops.h: return unlikely(swp_type(entry) == SWP_MIGRATION_READ ||
include/linux/swapops.h: return unlikely(swp_type(entry) == SWP_MIGRATION_WRITE);
include/linux/mm.h: return (unlikely(pgd_none(*pgd)) && __pud_alloc(mm, pgd, address))?
include/linux/mm.h: return (unlikely(pud_none(*pud)) && __pmd_alloc(mm, pud, address))?
include/linux/sched.h: return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
include/linux/sched.h: return unlikely(test_thread_flag(TIF_NEED_RESCHED));
include/linux/skbuff.h: return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len);
include/linux/skbuff.h: return unlikely(len > skb->len) ? NULL : __pskb_pull(skb, len);
include/net/inet_timewait_sock.h: return likely(sk->sk_state != TCP_TIME_WAIT) ?
include/net/pkt_cls.h: return unlikely((ptr + len) < skb->tail && ptr > skb->head);
include/asm-frv/uaccess.h: return likely(__access_ok(to, n)) ? __copy_to_user(to, from, n) : n;

Dave

--