public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yunsheng Lin <linyunsheng@huawei.com>
To: wang wei <a929244872@163.com>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Alexander Duyck <alexander.duyck@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>, <linux-mm@kvack.org>
Subject: Re: [PATCH net-next v7 01/15] mm: page_frag: add a test module for page_frag
Date: Wed, 19 Jun 2024 20:57:51 +0800	[thread overview]
Message-ID: <a0396334-e9fa-9ceb-5d6e-7bf798ed545a@huawei.com> (raw)
In-Reply-To: <45a90c2.baa1.1902bcfd33a.Coremail.a929244872@163.com>

On 2024/6/18 22:45, wang wei wrote:
> 
>>+
>>+static struct objpool_head ptr_pool;
>>+static int nr_objs = 512;
>>+static atomic_t nthreads;
>>+static struct completion wait;
>>+static struct page_frag_cache test_frag;
>>+
>>+static int nr_test = 5120000;
>>+module_param(nr_test, int, 0600);
> 
> 
> "S_IRUSR | S_IWUSR" is better than "0600".

Yes, it is better.
But as we do the testing in module init, it seems we could just
use module_param(nr_test, int, 0) instead.

> 
> 
>>+MODULE_PARM_DESC(nr_test, "number of iterations to test");
>>+
>>+static bool test_align;
>>+module_param(test_align, bool, 0600);
>>+MODULE_PARM_DESC(test_align, "use align API for testing");
>>+
>>+static int test_alloc_len = 2048;
>>+module_param(test_alloc_len, int, 0600);
>>+MODULE_PARM_DESC(test_alloc_len, "alloc len for testing");
>>+
>>+static int test_push_cpu;
>>+module_param(test_push_cpu, int, 0600);
>>+MODULE_PARM_DESC(test_push_cpu, "test cpu for pushing fragment");
>>+
>>+static int test_pop_cpu;
>>+module_param(test_pop_cpu, int, 0600);
>>+MODULE_PARM_DESC(test_pop_cpu, "test cpu for popping fragment");
>>+
>>+static int page_frag_pop_thread(void *arg)
>>+{
>>+	struct objpool_head *pool = arg;
>>+	int nr = nr_test;
>>+
>>+	pr_info("page_frag pop test thread begins on cpu %d\n",
>>+		smp_processor_id());
>>+
>>+	while (nr > 0) {
>>+		void *obj = objpool_pop(pool);
>>+
>>+		if (obj) {
>>+			nr--;
>>+			page_frag_free(obj);
>>+		} else {
>>+			cond_resched();
>>+		}
>>+	}
>>+
>>+	if (atomic_dec_and_test(&nthreads))
>>+		complete(&wait);
>>+
>>+	pr_info("page_frag pop test thread exits on cpu %d\n",
>>+		smp_processor_id());
>>+
>>+	return 0;
>>+}
>>+
>>+static int page_frag_push_thread(void *arg)
>>+{
>>+	struct objpool_head *pool = arg;
>>+	int nr = nr_test;
>>+
>>+	pr_info("page_frag push test thread begins on cpu %d\n",
>>+		smp_processor_id());
>>+
>>+	while (nr > 0) {
>>+		void *va;
>>+		int ret;
>>+
>>+		if (test_align)
>>+			va = page_frag_alloc_align(&test_frag, test_alloc_len,
>>+ GFP_KERNEL, SMP_CACHE_BYTES);
> 
> 
> Every page fragment max size is PAGE_FRAG_CACHE_MAX_SIZE, hence the value of test_alloc_len needs to be checked.
> 

yes, that needs to be checked.
limit the test_alloc_len to PGAE_SIZE seems better, as we may fail back to
order 0 page.

> 


  parent reply	other threads:[~2024-06-19 12:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-07 12:38 [PATCH net-next v7 00/15] First try to replace page_frag with page_frag_cache Yunsheng Lin
2024-06-07 12:38 ` [PATCH net-next v7 01/15] mm: page_frag: add a test module for page_frag Yunsheng Lin
     [not found]   ` <45a90c2.baa1.1902bcfd33a.Coremail.a929244872@163.com>
2024-06-19 12:57     ` Yunsheng Lin [this message]
2024-06-07 12:38 ` [PATCH net-next v7 02/15] xtensa: remove the get_order() implementation Yunsheng Lin
2024-06-07 12:38 ` [PATCH net-next v7 03/15] mm: page_frag: use free_unref_page() to free page fragment Yunsheng Lin
2024-06-07 12:38 ` [PATCH net-next v7 04/15] mm: move the page fragment allocator from page_alloc into its own file Yunsheng Lin
2024-06-07 12:38 ` [PATCH net-next v7 05/15] mm: page_frag: use initial zero offset for page_frag_alloc_align() Yunsheng Lin
2024-06-07 12:38 ` [PATCH net-next v7 06/15] mm: page_frag: add '_va' suffix to page_frag API Yunsheng Lin
2024-06-07 12:38 ` [PATCH net-next v7 07/15] mm: page_frag: avoid caller accessing 'page_frag_cache' directly Yunsheng Lin
2024-06-07 12:38 ` [PATCH net-next v7 08/15] mm: page_frag: reuse existing space for 'size' and 'pfmemalloc' Yunsheng Lin
2024-06-07 12:38 ` [PATCH net-next v7 09/15] mm: page_frag: some minor refactoring before adding new API Yunsheng Lin
2024-06-07 12:38 ` [PATCH net-next v7 10/15] mm: page_frag: use __alloc_pages() to replace alloc_pages_node() Yunsheng Lin
2024-06-07 12:38 ` [PATCH net-next v7 11/15] net: introduce the skb_copy_to_va_nocache() helper Yunsheng Lin
2024-06-07 12:38 ` [PATCH net-next v7 12/15] mm: page_frag: introduce prepare/probe/commit API Yunsheng Lin
2024-06-07 12:38 ` [PATCH net-next v7 13/15] net: replace page_frag with page_frag_cache Yunsheng Lin
2024-06-07 12:38 ` [PATCH net-next v7 14/15] mm: page_frag: update documentation for page_frag Yunsheng Lin
2024-06-07 12:38 ` [PATCH net-next v7 15/15] mm: page_frag: add a entry in MAINTAINERS " Yunsheng Lin
2024-06-11 12:55 ` [PATCH net-next v7 00/15] First try to replace page_frag with page_frag_cache Yunsheng Lin

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=a0396334-e9fa-9ceb-5d6e-7bf798ed545a@huawei.com \
    --to=linyunsheng@huawei.com \
    --cc=a929244872@163.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.duyck@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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