From: Eric Dumazet <eric.dumazet@gmail.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: netdev@vger.kernel.org, xen-devel@lists.xensource.com,
ian.campbell@citrix.com, konrad.wilk@oracle.com
Subject: Re: [RFC PATCH V4 01/13] netback: page pool version 1
Date: Thu, 02 Feb 2012 18:26:05 +0100 [thread overview]
Message-ID: <1328203565.13262.2.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC> (raw)
In-Reply-To: <1328201363-13915-2-git-send-email-wei.liu2@citrix.com>
Le jeudi 02 février 2012 à 16:49 +0000, Wei Liu a écrit :
> A global page pool. Since we are moving to 1:1 model netback, it is
> better to limit total RAM consumed by all the vifs.
>
> With this patch, each vif gets page from the pool and puts the page
> back when it is finished with the page.
>
> This pool is only meant to access via exported interfaces. Internals
> are subject to change when we discover new requirements for the pool.
>
> Current exported interfaces include:
>
> page_pool_init: pool init
> page_pool_destroy: pool destruction
> page_pool_get: get a page from pool
> page_pool_put: put page back to pool
> is_in_pool: tell whether a page belongs to the pool
>
> Current implementation has following defects:
> - Global locking
> - No starve prevention mechanism / reservation logic
>
> Global locking tends to cause contention on the pool. No reservation
> logic may cause vif to starve. A possible solution to these two
> problems will be each vif maintains its local cache and claims a
> portion of the pool. However the implementation will be tricky when
> coming to pool management, so let's worry about that later.
>
> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
Hmm, this kind of stuff should be discussed on lkml.
I doubt we want yet another memory allocator, with a global lock
(contended), and no NUMA properties.
> +int page_pool_init()
> +{
> + int cpus = 0;
> + int i;
> +
> + cpus = num_online_cpus();
> + pool_size = cpus * ENTRIES_PER_CPU;
> +
> + pool = vzalloc(sizeof(struct page_pool_entry) * pool_size);
> +
> + if (!pool)
> + return -ENOMEM;
> +
> + for (i = 0; i < pool_size - 1; i++)
> + pool[i].u.fl = i+1;
> + pool[pool_size-1].u.fl = INVALID_ENTRY;
> + free_count = pool_size;
> + free_head = 0;
> +
> + return 0;
> +}
> +
num_online_cpus() disease once again.
code depending on num_online_cpus() is always suspicious.
next prev parent reply other threads:[~2012-02-02 17:26 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-02 16:49 [RFC PATCH V4] Xen netback / netfront improvement Wei Liu
2012-02-02 16:49 ` [RFC PATCH V4 01/13] netback: page pool version 1 Wei Liu
2012-02-02 17:26 ` Eric Dumazet [this message]
2012-02-17 19:19 ` Konrad Rzeszutek Wilk
2012-02-20 16:26 ` Wei Liu
2012-02-02 16:49 ` [RFC PATCH V4 02/13] netback: add module unload function Wei Liu
2012-02-02 17:08 ` Eric Dumazet
2012-02-02 17:28 ` Wei Liu
2012-02-02 17:48 ` Eric Dumazet
2012-02-02 19:59 ` Ian Campbell
2012-02-02 20:34 ` Eric Dumazet
2012-02-02 20:37 ` Eric Dumazet
2012-02-02 20:50 ` Ian Campbell
2012-02-02 22:52 ` Paul Gortmaker
2012-02-03 6:38 ` Ian Campbell
2012-02-03 7:25 ` Eric Dumazet
2012-02-03 8:02 ` Ian Campbell
2012-02-03 11:27 ` Wei Liu
2012-02-02 16:49 ` [RFC PATCH V4 03/13] netback: add module get/put operations along with vif connect/disconnect Wei Liu
2012-02-02 16:49 ` [RFC PATCH V4 04/13] netback: switch to NAPI + kthread model Wei Liu
2012-02-02 16:49 ` [RFC PATCH V4 05/13] netback: switch to per-cpu scratch space Wei Liu
2012-02-02 16:49 ` [RFC PATCH V4 06/13] netback: melt xen_netbk into xenvif Wei Liu
2012-02-02 16:49 ` [RFC PATCH V4 07/13] netback: alter internal function/structure names Wei Liu
2012-02-02 16:49 ` [RFC PATCH V4 08/13] xenbus_client: extend interface to support mapping / unmapping of multi page ring Wei Liu
2012-02-03 16:55 ` Konrad Rzeszutek Wilk
2012-02-03 17:20 ` Wei Liu
2012-02-03 17:35 ` Konrad Rzeszutek Wilk
2012-02-06 17:21 ` Konrad Rzeszutek Wilk
2012-02-06 17:30 ` Wei Liu
2012-02-02 16:49 ` [RFC PATCH V4 09/13] Bundle fix for xen backends and frontends Wei Liu
2012-02-03 2:34 ` Konrad Rzeszutek Wilk
2012-02-02 16:49 ` [RFC PATCH V4 10/13] netback: multi page ring support Wei Liu
2012-02-02 16:49 ` [RFC PATCH V4 11/13] netback: split event channels support Wei Liu
2012-02-02 16:49 ` [RFC PATCH V4 12/13] netfront: multi page ring support Wei Liu
2012-02-15 22:42 ` Konrad Rzeszutek Wilk
2012-02-15 22:52 ` David Miller
2012-02-15 23:53 ` Konrad Rzeszutek Wilk
2012-02-16 10:02 ` Wei Liu
2012-02-16 10:16 ` Wei Liu
2012-02-17 15:10 ` Konrad Rzeszutek Wilk
2012-02-16 22:57 ` Konrad Rzeszutek Wilk
2012-02-02 16:49 ` [RFC PATCH V4 13/13] netfront: split event channels support Wei Liu
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=1328203565.13262.2.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC \
--to=eric.dumazet@gmail.com \
--cc=ian.campbell@citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=netdev@vger.kernel.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xensource.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;
as well as URLs for NNTP newsgroup(s).