[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1343401949.2626.13011.camel@edumazet-glaptop>
Date: Fri, 27 Jul 2012 17:12:29 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: David Miller <davem@...emloft.net>, alexander.duyck@...il.com,
netdev@...r.kernel.org
Subject: Re: [PATCH 00/16] Remove the ipv4 routing cache
On Fri, 2012-07-27 at 07:53 -0700, Eric W. Biederman wrote:
> Eric Dumazet <eric.dumazet@...il.com> writes:
>
> > Now IP route cache is removed, we should make sure fib structures
> > cant share cache lines with possibly often dirtied objects.
> >
> > On x86, kmalloc-96 cache can be source of such problems.
> >
> > Signed-off-by: Eric Dumazet <edumazet@...gle.com>
>
>
> > +static inline void *fib_zalloc(size_t size)
> > +{
> > + /* We want to avoid possible false sharing */
> > + return kzalloc(max_t(size_t, 128, size), GFP_KERNEL);
>
> Why the hard coded 128 here?
>
> It seems more portable and obvious to do
> return kzalloc(round_up(size, L1_CACHE_BYTES), GFP_KERNEL);
>
Its not that obvious, because some machines have an apparent
L1_CACHE_BYTES of 64, but hardware prefetching to 128 bytes
But using 2*L1_CACHE_BYTES as minimum allocation size might be overkill
on some arches with 256 bytes cache lines.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists