linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin LaHaise <bcrl@linux.intel.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-mm@kvack.org, netdev@vger.kernel.org
Subject: Re: [PATCH] avoid atomic op on page free
Date: Mon, 6 Mar 2006 17:52:29 -0800	[thread overview]
Message-ID: <20060307015229.GJ32565@linux.intel.com> (raw)
In-Reply-To: <20060306173941.4b5e0fc7.akpm@osdl.org>

On Mon, Mar 06, 2006 at 05:39:41PM -0800, Andrew Morton wrote:
> > It's just a simple send() and recv() pair of processes.  Networking uses 
> > pages for the buffer on user transmits.
> 
> You mean non-zero-copy transmits?  If they were zero-copy then those pages
> would still be on the LRU.

Correct.

> >  Those pages tend to be freed 
> > in irq context on transmit or in the receiver if the traffic is local.
> 
> If it was a non-zero-copy Tx then networking owns that page and can just do
> free_hot_page() on it and avoid all that stuff in put_page().

At least currently, networking has no way of knowing that is the case since 
pages may have their reference count increased when an skb() is cloned, and 
in fact do when TCP sends them off.

> Thing is, that case would represent about 1000000th of the number of
> put_pages()s which get done in the world.  IOW: a net loss.

Those 1-2 cycles are free if you look at how things get scheduled with the 
execution of the surrounding code. I bet $20 that you can't find a modern 
CPU where the cost is measurable (meaning something like a P4, Athlon).  
If this level of cost for the common case is a concern, it's probably worth 
making atomic_dec_and_test() inline for page_cache_release().  The overhead 
of the function call and the PageCompound() test is probably more than what 
we're talking about as you're increasing the cache footprint and actually 
performing a write to memory.

		-ben

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2006-03-07  1:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-07  0:10 Benjamin LaHaise
2006-03-07  0:50 ` Andrew Morton
2006-03-07  1:11   ` Benjamin LaHaise
2006-03-07  1:39     ` Andrew Morton
2006-03-07  1:52       ` Benjamin LaHaise [this message]
2006-03-07  6:30         ` Andi Kleen
2006-03-07  2:04     ` Nick Piggin
2006-03-07  2:10       ` Benjamin LaHaise
2006-03-07  4:08         ` Nick Piggin
2006-03-07  2:30       ` Chen, Kenneth W
2006-03-07  4:13         ` Nick Piggin
2006-03-07  1:21   ` Rick Jones
2006-03-07  1:53 ` Nick Piggin
2006-03-07  1:58   ` Benjamin LaHaise
2006-03-07  2:14     ` Nick Piggin

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=20060307015229.GJ32565@linux.intel.com \
    --to=bcrl@linux.intel.com \
    --cc=akpm@osdl.org \
    --cc=linux-mm@kvack.org \
    --cc=netdev@vger.kernel.org \
    /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