linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yunsheng Lin <linyunsheng@huawei.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: <davem@davemloft.net>, <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 v5 01/13] mm: page_frag: add a test module for page_frag
Date: Fri, 31 May 2024 16:50:35 +0800	[thread overview]
Message-ID: <24240fe0-00ca-a9cc-6087-1de720951896@huawei.com> (raw)
In-Reply-To: <20240530081653.769e4377@kernel.org>

On 2024/5/30 23:16, Jakub Kicinski wrote:
> On Thu, 30 May 2024 17:17:17 +0800 Yunsheng Lin wrote:
>>> Is this test actually meaningfully testing page_frag or rather
>>> the objpool construct and the scheduler? :S  
>>
>> For the objpool part, I guess it is ok to say that it is a
>> meaningfully testing for both page_frag and objpool if there is
>> changing to either of them.
> 
> Why guess when you can measure it. 
> Slow one down and see if it impacts the benchmark.

Before the slowing down on arm64 system:

 Performance counter stats for 'insmod ./page_frag_test.ko test_push_cpu=16 test_pop_cpu=17' (500 runs):

         19.420606      task-clock (msec)         #    0.001 CPUs utilized            ( +-  0.82% )
                 7      context-switches          #    0.377 K/sec                    ( +-  0.30% )
                 1      cpu-migrations            #    0.038 K/sec                    ( +-  2.82% )
                84      page-faults               #    0.004 M/sec                    ( +-  0.06% )
          50423999      cycles                    #    2.596 GHz                      ( +-  0.82% )
          35558295      instructions              #    0.71  insn per cycle           ( +-  0.09% )
           8340405      branches                  #  429.462 M/sec                    ( +-  0.08% )
             20669      branch-misses             #    0.25% of all branches          ( +-  0.10% )

      24.047641626 seconds time elapsed                                          ( +-  0.08% )


And there are 5120000 push and pop operations for each iteration,
so roughly each push and pop operation costs about 4687ns.

By adding 50ns delay in *__page_frag_alloc_va_align()
@@ -300,6 +297,8 @@ void *__page_frag_alloc_va_align(struct page_frag_cache *nc,
 {
        unsigned int remaining = nc->remaining & align_mask;

+       ndelay(50);
+
        if (unlikely(fragsz > remaining)) {


We have:
 Performance counter stats for 'insmod ./page_frag_test.ko test_push_cpu=16 test_pop_cpu=17' (500 runs):

         18.012657      task-clock (msec)         #    0.001 CPUs utilized            ( +-  0.01% )
                 7      context-switches          #    0.395 K/sec                    ( +-  0.20% )
                 1      cpu-migrations            #    0.052 K/sec                    ( +-  1.35% )
                84      page-faults               #    0.005 M/sec                    ( +-  0.06% )
          46765406      cycles                    #    2.596 GHz                      ( +-  0.01% )
          35253336      instructions              #    0.75  insn per cycle           ( +-  0.00% )
           8277063      branches                  #  459.514 M/sec                    ( +-  0.00% )
             20558      branch-misses             #    0.25% of all branches          ( +-  0.07% )

      24.313647557 seconds time elapsed                                          ( +-  0.07% )


(24.313647557 - 24.047641626) * 1000000000 / 5120000 = 51ns, so the
testing seems correct.

> 
>> For the scheduler part, this test provides the below module param
>> to avoid the the noise from scheduler.
>>
>> +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");
>>
>> Or is there any better idea for testing page_frag?
> 
> .
> 


  reply	other threads:[~2024-05-31  8:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240528125604.63048-1-linyunsheng@huawei.com>
2024-05-28 12:55 ` Yunsheng Lin
2024-05-30  0:29   ` Jakub Kicinski
2024-05-30  9:17     ` Yunsheng Lin
2024-05-30 15:16       ` Jakub Kicinski
2024-05-31  8:50         ` Yunsheng Lin [this message]
2024-05-28 12:55 ` [PATCH net-next v5 03/13] mm: page_frag: use free_unref_page() to free page fragment Yunsheng Lin
2024-05-28 12:55 ` [PATCH net-next v5 04/13] mm: move the page fragment allocator from page_alloc into its own file Yunsheng Lin
2024-05-28 12:55 ` [PATCH net-next v5 05/13] mm: page_frag: use initial zero offset for page_frag_alloc_align() Yunsheng Lin
2024-05-28 12:55 ` [PATCH net-next v5 06/13] mm: page_frag: add '_va' suffix to page_frag API Yunsheng Lin
2024-05-28 12:55 ` [PATCH net-next v5 07/13] mm: page_frag: avoid caller accessing 'page_frag_cache' directly Yunsheng Lin
2024-05-28 12:55 ` [PATCH net-next v5 08/13] mm: page_frag: reuse existing space for 'size' and 'pfmemalloc' Yunsheng Lin
2024-05-28 12:56 ` [PATCH net-next v5 10/13] mm: page_frag: introduce prepare/probe/commit API Yunsheng Lin
2024-05-30  9:21   ` Yunsheng Lin
2024-05-28 12:56 ` [PATCH net-next v5 12/13] mm: page_frag: update documentation for page_frag 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=24240fe0-00ca-a9cc-6087-1de720951896@huawei.com \
    --to=linyunsheng@huawei.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