mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Seems the comment of find_next_system_ram() is not exact
@ 2011-09-24 13:40 Wizard
  2011-09-25  9:42 ` Borislav Petkov
  0 siblings, 1 reply; 5+ messages in thread
From: Wizard @ 2011-09-24 13:40 UTC (permalink / raw)
  To: linux-kernel

Hi, Experts

I am a newbie for linux kernel. I just read the code of
find_next_system_ram() in kernel/resource.c

I think the comment of this function is not exact. This says "Finds
the lowest memory reosurce exists within [res->start.res->end)".

While I think the code is to find the lowest memory resource overlaps
[res->start, res->end).

308:      if ((p->end >= start) && (p->start < end))

If I am not correct, please let me know. :)

BTW, I find the "reosurce" is a typo.

-- 
Wizard

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Seems the comment of find_next_system_ram() is not exact
  2011-09-24 13:40 Seems the comment of find_next_system_ram() is not exact Wizard
@ 2011-09-25  9:42 ` Borislav Petkov
  2011-09-25 15:02   ` Wizard
  0 siblings, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2011-09-25  9:42 UTC (permalink / raw)
  To: Wizard; +Cc: linux-kernel, KAMEZAWA Hiroyuki

On Sat, Sep 24, 2011 at 09:40:52PM +0800, Wizard wrote:
> Hi, Experts
> 
> I am a newbie for linux kernel. I just read the code of
> find_next_system_ram() in kernel/resource.c
> 
> I think the comment of this function is not exact. This says "Finds
> the lowest memory reosurce exists within [res->start.res->end)".
> 
> While I think the code is to find the lowest memory resource overlaps
> [res->start, res->end).
> 
> 308:      if ((p->end >= start) && (p->start < end))
> 
> If I am not correct, please let me know. :)

Right,

hint for the future, do a "git annotate" on the file containing that
code - the patch adding the piece of code might (err, and should!) have
a verbose commit message explaining the situation. And it seems it does
have something to a degree, here's another hint:

58c1b5b079071

:-)

But I agree that the comment over the function could use some more
verbosity on why the function needs to handle overlapping resources and
sections. Let's ask the author.

> BTW, I find the "reosurce" is a typo.

Yes, he could fix it while explaining the overlap :-).

HTH.

-- 
Regards/Gruss,
    Boris.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Seems the comment of find_next_system_ram() is not exact
  2011-09-25  9:42 ` Borislav Petkov
@ 2011-09-25 15:02   ` Wizard
  2011-09-25 20:09     ` Borislav Petkov
  2011-09-26  0:26     ` KAMEZAWA Hiroyuki
  0 siblings, 2 replies; 5+ messages in thread
From: Wizard @ 2011-09-25 15:02 UTC (permalink / raw)
  To: Borislav Petkov, Wizard, linux-kernel, KAMEZAWA Hiroyuki

Borislav

Thanks for your reply and for your suggestion to use "git annotate".
I learned a lot from you.

I see the commit by KAMEZAWA. While still not know why he change
code this way to cover the overlap case.

I find the function is introduced in 2842f11419704f8707fffc82e10d2263427fc130.
While the mm/memory_hotplug.c is chaged during this period.
If I want to view the code at that moment, I should use git checkout
2842f11419704f8707fffc82e10d2263427fc130?



2011/9/25, Borislav Petkov <bp@alien8.de>:
> On Sat, Sep 24, 2011 at 09:40:52PM +0800, Wizard wrote:
>> Hi, Experts
>>
>> I am a newbie for linux kernel. I just read the code of
>> find_next_system_ram() in kernel/resource.c
>>
>> I think the comment of this function is not exact. This says "Finds
>> the lowest memory reosurce exists within [res->start.res->end)".
>>
>> While I think the code is to find the lowest memory resource overlaps
>> [res->start, res->end).
>>
>> 308:      if ((p->end >= start) && (p->start < end))
>>
>> If I am not correct, please let me know. :)
>
> Right,
>
> hint for the future, do a "git annotate" on the file containing that
> code - the patch adding the piece of code might (err, and should!) have
> a verbose commit message explaining the situation. And it seems it does
> have something to a degree, here's another hint:
>
> 58c1b5b079071
>
> :-)
>
> But I agree that the comment over the function could use some more
> verbosity on why the function needs to handle overlapping resources and
> sections. Let's ask the author.
>
>> BTW, I find the "reosurce" is a typo.
>
> Yes, he could fix it while explaining the overlap :-).
>
> HTH.
>
> --
> Regards/Gruss,
>     Boris.
>


-- 
Wizard

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Seems the comment of find_next_system_ram() is not exact
  2011-09-25 15:02   ` Wizard
@ 2011-09-25 20:09     ` Borislav Petkov
  2011-09-26  0:26     ` KAMEZAWA Hiroyuki
  1 sibling, 0 replies; 5+ messages in thread
From: Borislav Petkov @ 2011-09-25 20:09 UTC (permalink / raw)
  To: Wizard; +Cc: linux-kernel, KAMEZAWA Hiroyuki

On Sun, Sep 25, 2011 at 11:02:47PM +0800, Wizard wrote:

Hi,

please do not top-post when replying to messages.

> Thanks for your reply and for your suggestion to use "git annotate".
> I learned a lot from you.
> 
> I see the commit by KAMEZAWA. While still not know why he change
> code this way to cover the overlap case.
> 
> I find the function is introduced in 2842f11419704f8707fffc82e10d2263427fc130.
> While the mm/memory_hotplug.c is chaged during this period.
> If I want to view the code at that moment, I should use git checkout
> 2842f11419704f8707fffc82e10d2263427fc130?

No need, you can simply do

git show 2842f11419704f8707fffc82e10d2263427fc130:kernel/resource.c

as with every other git commit and file tracked by git.

HTH.

-- 
Regards/Gruss,
    Boris.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Seems the comment of find_next_system_ram() is not exact
  2011-09-25 15:02   ` Wizard
  2011-09-25 20:09     ` Borislav Petkov
@ 2011-09-26  0:26     ` KAMEZAWA Hiroyuki
  1 sibling, 0 replies; 5+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-09-26  0:26 UTC (permalink / raw)
  To: Wizard; +Cc: Borislav Petkov, linux-kernel

On Sun, 25 Sep 2011 23:02:47 +0800
Wizard <wizarddewhite@gmail.com> wrote:

> Borislav
> 
> Thanks for your reply and for your suggestion to use "git annotate".
> I learned a lot from you.
> 
> I see the commit by KAMEZAWA. While still not know why he change
> code this way to cover the overlap case.
> 

yes. comment is wrong. I cannot write patch now. could you fix ?


Thanks,
-Kame


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-09-26  0:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-24 13:40 Seems the comment of find_next_system_ram() is not exact Wizard
2011-09-25  9:42 ` Borislav Petkov
2011-09-25 15:02   ` Wizard
2011-09-25 20:09     ` Borislav Petkov
2011-09-26  0:26     ` KAMEZAWA Hiroyuki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®