mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Xu, Yanfei" <yanfei.xu@windriver.com>
To: Vlastimil Babka <vbabka@suse.cz>,
	akpm@linux-foundation.org, david@redhat.com
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm/compaction: Rename 'start_pfn' to 'iteration_start_pfn' in compact_zone()
Date: Mon, 19 Oct 2020 18:29:49 +0800	[thread overview]
Message-ID: <4aa294a0-c256-7e89-55af-6a7c790eec4d@windriver.com> (raw)
In-Reply-To: <57730b8a-f5d7-d6c7-3961-3fa95701aba5@suse.cz>



On 10/19/20 5:40 PM, Vlastimil Babka wrote:
> On 10/19/20 10:36 AM, yanfei.xu@windriver.com wrote:
>> From: Yanfei Xu <yanfei.xu@windriver.com>
>>
>> There are two 'start_pfn' declared in compact_zone() which have
>> different meaning. Rename the second one to 'iteration_start_pfn'
>> to prevent trace_mm_compaction_end() from tracing an undesirable
>> value.
> 
> "to prevent confusion.", because trace_mm_compaction_end() has the
> correct value even before the patch - the second start_pfn is out
> of scope at that point.
> 
> Thanks
>
In the while-statement, the second start_pfn is always be reassigned the 
value of cc->migrate_pfn in every loop, also the cc->migrate_pfn might 
be changed in the loop. Does trace_mm_compaction_end() really want to 
trace the new assinged start_pfn?

Without the patch: 566e54e11(mm, compaction: remove last_migrated_pfn 
from compact_control), there is only one start_pfn which has a fixed 
value. The trace_mm_compaction_end() trace it too.

Thus, I think the tracepoint might get an undesireble value.:)

Thanks,
Yanfei

>> BTW, remove an useless semicolon.
>>
>> Acked-by: David Hildenbrand <david@redhat.com>
>> Acked-by: Vlastimil Babka <vbabka@suse.cz>
>> Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
>> ---
>> v1->v2:
>> Rename 'start_pfn' to 'iteration_start_pfn' and change commit messages.
>>
>>   mm/compaction.c | 7 +++----
>>   1 file changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/mm/compaction.c b/mm/compaction.c
>> index 176dcded298e..ccd27c739fd6 100644
>> --- a/mm/compaction.c
>> +++ b/mm/compaction.c
>> @@ -2272,7 +2272,7 @@ compact_zone(struct compact_control *cc, struct 
>> capture_control *capc)
>>       while ((ret = compact_finished(cc)) == COMPACT_CONTINUE) {
>>           int err;
>> -        unsigned long start_pfn = cc->migrate_pfn;
>> +        unsigned long iteration_start_pfn = cc->migrate_pfn;
>>           /*
>>            * Avoid multiple rescans which can happen if a page cannot be
>> @@ -2284,7 +2284,7 @@ compact_zone(struct compact_control *cc, struct 
>> capture_control *capc)
>>            */
>>           cc->rescan = false;
>>           if (pageblock_start_pfn(last_migrated_pfn) ==
>> -            pageblock_start_pfn(start_pfn)) {
>> +            pageblock_start_pfn(iteration_start_pfn)) {
>>               cc->rescan = true;
>>           }
>> @@ -2308,8 +2308,7 @@ compact_zone(struct compact_control *cc, struct 
>> capture_control *capc)
>>               goto check_drain;
>>           case ISOLATE_SUCCESS:
>>               update_cached = false;
>> -            last_migrated_pfn = start_pfn;
>> -            ;
>> +            last_migrated_pfn = iteration_start_pfn;
>>           }
>>           err = migrate_pages(&cc->migratepages, compaction_alloc,
>>
> 
> 

  reply	other threads:[~2020-10-19 10:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19  8:36 yanfei.xu
2020-10-19  8:50 ` Pankaj Gupta
2020-10-19  9:40 ` Vlastimil Babka
2020-10-19 10:29   ` Xu, Yanfei [this message]
2020-10-19 10:48     ` Vlastimil Babka
2020-10-19 11:39       ` Xu, Yanfei

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=4aa294a0-c256-7e89-55af-6a7c790eec4d@windriver.com \
    --to=yanfei.xu@windriver.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=vbabka@suse.cz \
    /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

all inboxes | Powered by JetHome®