Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1578920 > unrolled thread

Re: [RFC PATCH 2/2] mm/sparse: add last_section_nr in sparse_init() to reduce some iteration cycle

Started byTejun Heo <tj@kernel.org>
First post2017-02-11 03:30 +0100
Last post2017-02-17 15:20 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC PATCH 2/2] mm/sparse: add last_section_nr in sparse_init()  to reduce some iteration cycle Tejun Heo <tj@kernel.org> - 2017-02-11 03:30 +0100
    Re: [RFC PATCH 2/2] mm/sparse: add last_section_nr in sparse_init()  to reduce some iteration cycle Wei Yang <richard.weiyang@gmail.com> - 2017-02-13 14:10 +0100
      Re: [RFC PATCH 2/2] mm/sparse: add last_section_nr in sparse_init()  to reduce some iteration cycle Wei Yang <richard.weiyang@gmail.com> - 2017-02-17 15:20 +0100

#1578920 — Re: [RFC PATCH 2/2] mm/sparse: add last_section_nr in sparse_init() to reduce some iteration cycle

FromTejun Heo <tj@kernel.org>
Date2017-02-11 03:30 +0100
SubjectRe: [RFC PATCH 2/2] mm/sparse: add last_section_nr in sparse_init() to reduce some iteration cycle
Message-ID<t9vBL-3eg-7@gated-at.bofh.it>
Hello,

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?

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

Thanks.

-- 
tejun

[toc] | [next] | [standalone]


#1579706

FromWei Yang <richard.weiyang@gmail.com>
Date2017-02-13 14:10 +0100
Message-ID<taoye-47y-37@gated-at.bofh.it>
In reply to#1578920
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

[toc] | [prev] | [next] | [standalone]


#1583446

FromWei Yang <richard.weiyang@gmail.com>
Date2017-02-17 15:20 +0100
Message-ID<tbRya-5mq-25@gated-at.bofh.it>
In reply to#1579706
On Mon, Feb 13, 2017 at 9:03 PM, Wei Yang <richard.weiyang@gmail.com> wrote:
> 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.
>

Hi, Tejun

What's your opinion on this change?

>> * 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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web