From: Li RongQing <lirongqing@baidu.com>
To: netdev@vger.kernel.org, brouer@redhat.com
Subject: [PATCH] page_pool: fill page only when refill condition is true
Date: Wed, 5 Feb 2020 16:22:34 +0800 [thread overview]
Message-ID: <1580890954-21322-1-git-send-email-lirongqing@baidu.com> (raw)
"do {} while" in page_pool_refill_alloc_cache will always
refill page once whether refill is true or false, and whether
alloc.count of pool is less than PP_ALLOC_CACHE_REFILL.
so fix it by calling page_pool_refill_alloc_cache() only when
refill is true
Fixes: 44768decb7c0 ("page_pool: handle page recycle for NUMA_NO_NODE condition")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>
---
net/core/page_pool.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/net/core/page_pool.c b/net/core/page_pool.c
index 9b7cbe35df37..35ce663cb9de 100644
--- a/net/core/page_pool.c
+++ b/net/core/page_pool.c
@@ -99,8 +99,7 @@ EXPORT_SYMBOL(page_pool_create);
static void __page_pool_return_page(struct page_pool *pool, struct page *page);
noinline
-static struct page *page_pool_refill_alloc_cache(struct page_pool *pool,
- bool refill)
+static struct page *page_pool_refill_alloc_cache(struct page_pool *pool)
{
struct ptr_ring *r = &pool->ring;
struct page *page;
@@ -141,8 +140,7 @@ static struct page *page_pool_refill_alloc_cache(struct page_pool *pool,
page = NULL;
break;
}
- } while (pool->alloc.count < PP_ALLOC_CACHE_REFILL &&
- refill);
+ } while (pool->alloc.count < PP_ALLOC_CACHE_REFILL);
/* Return last page */
if (likely(pool->alloc.count > 0))
@@ -156,7 +154,7 @@ static struct page *page_pool_refill_alloc_cache(struct page_pool *pool,
static struct page *__page_pool_get_cached(struct page_pool *pool)
{
bool refill = false;
- struct page *page;
+ struct page *page = NULL;
/* Test for safe-context, caller should provide this guarantee */
if (likely(in_serving_softirq())) {
@@ -168,7 +166,8 @@ static struct page *__page_pool_get_cached(struct page_pool *pool)
refill = true;
}
- page = page_pool_refill_alloc_cache(pool, refill);
+ if (refill)
+ page = page_pool_refill_alloc_cache(pool);
return page;
}
--
2.16.2
next reply other threads:[~2020-02-05 8:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-05 8:22 Li RongQing [this message]
2020-02-05 11:50 ` [PATCH] page_pool: fill page only when refill condition is true Jesper Dangaard Brouer
2020-02-06 2:23 ` 答复: " Li,Rongqing
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=1580890954-21322-1-git-send-email-lirongqing@baidu.com \
--to=lirongqing@baidu.com \
--cc=brouer@redhat.com \
--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