From: Eric Dumazet <eric.dumazet@gmail.com>
To: Changli Gao <xiaosuo@gmail.com>
Cc: Neil Horman <nhorman@tuxdriver.com>,
"David S. Miller" <davem@davemloft.net>,
Jiri Pirko <jpirko@redhat.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] af_packet: use vmalloc_to_page() instead for the addresss returned by vmalloc()
Date: Wed, 01 Dec 2010 14:43:16 +0100 [thread overview]
Message-ID: <1291210996.2856.749.camel@edumazet-laptop> (raw)
In-Reply-To: <1291210691.2856.740.camel@edumazet-laptop>
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@tuxdriver.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.
next prev parent reply other threads:[~2010-12-01 13:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-30 13:56 [PATCH 1/2] af_packet: use vmalloc_to_page() instead for the addresss returned by vmalloc() Changli Gao
2010-11-30 14:12 ` Eric Dumazet
2010-11-30 14:27 ` Changli Gao
2010-11-30 14:37 ` Neil Horman
2010-12-01 13:05 ` Changli Gao
2010-12-01 13:38 ` Eric Dumazet
2010-12-01 13:43 ` Eric Dumazet [this message]
2010-12-01 14:16 ` Changli Gao
2010-12-01 15:13 ` Eric Dumazet
2010-12-01 20:44 ` Neil Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1291210996.2856.749.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=jpirko@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=xiaosuo@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox