linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <richard.weiyang@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 2/2] mm/sparse: add last_section_nr in sparse_init() to reduce some iteration cycle
Date: Mon, 13 Feb 2017 21:03:41 +0800	[thread overview]
Message-ID: <CADZGycbxtoXXxCeg-nHjzGmHA72VnA=-td+hNaNqN67Vq2JuKg@mail.gmail.com> (raw)
In-Reply-To: <20170211022400.GA19050@mtj.duckdns.org>

On Sat, Feb 11, 2017 at 10:24 AM, Tejun Heo <tj@kernel.org> wrote:
>
> Hello,
>

Hi, Tejun

Sorry for the delay, my gmail client seems to facing some problem.
I can't see latest mails. So I have to use the web client and reply.

> On Sat, Feb 11, 2017 at 10:18:29AM +0800, Wei Yang wrote:
> > During the sparse_init(), it iterate on each possible section. On x86_64,
> > it would always be (2^19) even there is not much memory. For example, on a
> > typical 4G machine, it has only (2^5) to (2^6) present sections. This
> > benefits more on a system with smaller memory.
> >
> > This patch calculates the last section number from the highest pfn and use
> > this as the boundary of iteration.
>
> * How much does this actually matter?  Can you measure the impact?
>

Hmm, I tried to print the "jiffies", while it is not ready at that moment. So
I mimic the behavior in user space.

I used following code for test.

#include <stdio.h>
#include <stdlib.h>

int array[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

int main()
{
unsigned long i;
int val;

    for (i = 0; i < (1UL << 5); i++)
        val += array[i%10];
    for (i = 0; i < (1UL << 5); i++)
        val += array[i%10];
    for (i = 0; i < (1UL << 5); i++)
        val += array[i%10];

    //printf("%lx %d\n", i, val);

    return 0;
}

And compare the ruling with the iteration for the loop to be (1UL <<
5) and (1UL << 19).
The runtime is 0.00s and 0.04s respectively. The absolute value is not much.

> * Do we really need to add full reverse iterator to just get the
>   highest section number?
>

You are right. After I sent out the mail, I realized just highest pfn
is necessary.

> Thanks.
>
> --
> tejun

--
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:[~2017-02-13 13:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-11  2:18 [RFC PATCH 1/2] mm/memblock: introduce for_each_mem_pfn_range_rev() Wei Yang
2017-02-11  2:18 ` [RFC PATCH 2/2] mm/sparse: add last_section_nr in sparse_init() to reduce some iteration cycle Wei Yang
2017-02-11  2:24   ` Tejun Heo
2017-02-13 13:03     ` Wei Yang [this message]
2017-02-17 14:12       ` Wei Yang
2017-03-06 19:42         ` Tejun Heo
2017-03-08  8:00           ` Wei Yang

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='CADZGycbxtoXXxCeg-nHjzGmHA72VnA=-td+hNaNqN67Vq2JuKg@mail.gmail.com' \
    --to=richard.weiyang@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=tj@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