lkml.org 
[lkml]   [2006]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 08/13] hrtimer: remove data field
Hi,

On Mon, 13 Feb 2006, Ingo Molnar wrote:

> > The nanosleep cleanup allows to remove the data field of hrtimer. The
> > callback function can use container_of() to get it's own data. Since
> > the hrtimer structure is usually embedded in other structures, the
> > code also becomes a bit simpler.
>
> i addressed this when you first raised this issue (back in the ktimers
> flamewars), and generally the feeling of people i asked was that doing
> the container_of() approach is less readable than an explicit 'data'
> field. It also deviates from struct timer_list, which we wanted to stay
> close to. Furthermore, for standalone hrtimers this creates the need to
> generate a wrapper structure. So i dont really like this change - but no
> strong feelings either way.

With the complete size reduction struct hrtimer becomes 32 bytes on 32
bits archs and so we can fit the basic hrtimer into one or two cache
lines.
container_of() is becoming more and more common in the kernel, so I don't
know who asked, it's not that difficult to use. I agree it makes simple
test modules a bit more difficult, but so far the more common case is that
this structure is embedded in other structures and container_of() creates
simpler code. Additionally you get type checking for free, which you don't
get with a void pointer.

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

\
 
 \ /
  Last update: 2006-02-13 22:25    [W:0.461 / U:1.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site