[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1291210996.2856.749.camel@edumazet-laptop>
Date: Wed, 01 Dec 2010 14:43:16 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: Changli Gao <xiaosuo@...il.com>
Cc: Neil Horman <nhorman@...driver.com>,
"David S. Miller" <davem@...emloft.net>,
Jiri Pirko <jpirko@...hat.com>, netdev@...r.kernel.org
Subject: Re: [PATCH 1/2] af_packet: use vmalloc_to_page() instead for the
addresss returned by vmalloc()
Le mercredi 01 décembre 2010 à 14:38 +0100, Eric Dumazet a écrit :
> Le mercredi 01 décembre 2010 à 21:05 +0800, Changli Gao a écrit :
> > On Tue, Nov 30, 2010 at 10:37 PM, Neil Horman <nhorman@...driver.com> wrote:
> > > Off the top of my head, I would think that pgv_to_page could be prototyped such
> > > that it could accept addr, offset and struct page ** arguments. That way we can
> > > track the current page that we're mapped to, lowering the number of calls to
> > > vmalloc_to_page, and we can still use an increment like we do above (as long as
> > > its wrapped in a subsequent call to pgv_to_page)
> >
> > I'll try to optimize pgv_to_page() after this patch series merged. I
> > am planning to call vmalloc_to_page() previously, and cache its result
> > in a per pgv array for future use. Thanks.
> >
> >
>
> Hmm... fact is flush_dcache_page() is void on some arches.
>
> Maybe the only thing to do is avoid pgv_to_page() calls if
> ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE is 0
>
> The ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE symbol was introduced to avoid
> pointless empty cache-thrashing loops on architectures for which
> flush_dcache_page() is a no-op. Every architecture was provided with this
> flush pages on architectires where ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE is
> equal 1 or do nothing otherwise.
>
>
I guess using __pure attribute on pgv_to_page() should be enough ;)
static inline __pure struct page *pgv_to_page(void *addr)
{
if (is_vmalloc_addr(addr))
return vmalloc_to_page(addr);
return virt_to_page(addr);
}
Compiler then should optimize away
flush_dcache_page(pgv_to_page(addr));
But the pgv_to_page() done in packet_sendmsg() will stay, of course.
--
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