On Tue, Apr 2, 2019 at 1:51 PM Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote: > > On Tue, Apr 02, 2019 at 10:42:38AM -0700, Cong Wang wrote: > > I think these likely()/unlikely() are reasonable, ill-formatted packets > > are rare cases, normal packets deserve such a special care. We > > use likely()/unlikely() with pskb_may_pull() in many places in > > networking subsystem, at least. > > The likely()/unlikely() annotations are to help the compiler optimize > the fast path. They are not there just for decorating the code. We > should only use likely()/unlikely() where it makes a difference in > benchmarking. Otherwise it's just a style question, right (obviously)? That is not a requirement. Unless you have a strong argument to believe likely()/unlikely() doesn't help in this specific case (ill-formatted packets), we should by default use it. Coding style is not a strong argument, it is purely a taste. At least, does CodingStyle forbid to use it in this case? I tried checkpatch.pl, it has no such a complain. Thanks.