mm/compaction: Remove some useless code in compact_zone()
Subsystems (2)
PATCH 1/1 mm/compaction: Remove some useless code in compact_zone()
From: Yanfei Xu <[email protected]>
start_pfn has been declared at the begin of compact_zone(), it's no need to declare it again. And remove an useless semicolon.
--- mm/compaction.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
mm/compaction.c +1 -2
@@ -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; + start_pfn = cc->migrate_pfn;/* * Avoid multiple rescans which can happen if a page cannot be
@@ -2309,7 +2309,6 @@ compact_zone(struct compact_control *cc, struct capture_control *capc)case ISOLATE_SUCCESS : update_cached = false; last_migrated_pfn = start_pfn; - ; } err = migrate_pages(&cc->migratepages, compaction_alloc,
Signature · 1 line
2.18.2
Quoted 15 lines · On 14.10.20 09:23, [email protected] wrote:
From: Yanfei Xu <[email protected]>
start_pfnhas been declared at the begin ofcompact_zone(), it's no need to declare it again. And remove an useless semicolon.Signed-off-by Yanfei Xu <[email protected]>--- mm/compaction.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)mm/compaction.c +0
-0
mm/compaction.c compact_zone(struct compact_control *cc, struct capture_control *capc) · line 2275
Quoted 5 lines
mm/compaction.c +1
-1@@ -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; + start_pfn = cc->migrate_pfn;
There is a user in
trace_mm_compaction_end(start_pfn, cc->migrate_pfn, cc->free_pfn, end_pfn, sync, ret);
we would now trace a different value, no?
mm/compaction.c compact_zone(struct compact_control *cc, struct capture_control *capc) · line 2312
Quoted 8 lines
mm/compaction.c +0
-1/* * Avoid multiple rescans which can happen if a page cannot be @@ -2309,7 +2309,6 @@ compact_zone(struct compact_control *cc, struct capture_control *capc)case ISOLATE_SUCCESS : update_cached = false; last_migrated_pfn = start_pfn; - ;
Huh, how does something like that happen :)
Signature · 3 lines
Thanks, David / dhildenb
Quoted 24 lines · David Hildenbrand
Quoted 15 lines · On 14.10.20 09:23, [email protected] wrote:
From: Yanfei Xu <[email protected]>
start_pfnhas been declared at the begin ofcompact_zone(), it's no need to declare it again. And remove an useless semicolon.Signed-off-by Yanfei Xu <[email protected]>--- mm/compaction.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)mm/compaction.c +0
-0mm/compaction.c compact_zone(struct compact_control *cc, struct capture_control *capc) · line 2275
Quoted 5 lines
mm/compaction.c +1
-1@@ -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; + start_pfn = cc->migrate_pfn;There is a user in
Quoted 4 lines
trace_mm_compaction_end(start_pfn, cc->migrate_pfn, cc->free_pfn, end_pfn, sync, ret);we would now trace a different value, no?
Agreed. We should rather rename the while-local one to avoid confusion. Something like "iteration_start_pfn" ?
Quoted 10 lines
mm/compaction.c compact_zone(struct compact_control *cc, struct capture_control *capc) · line 2312
Quoted 8 lines
mm/compaction.c +0
-1/* * Avoid multiple rescans which can happen if a page cannot be @@ -2309,7 +2309,6 @@ compact_zone(struct compact_control *cc, struct capture_control *capc)case ISOLATE_SUCCESS : update_cached = false; last_migrated_pfn = start_pfn; - ;Huh, how does something like that happen :)
Looks like "case ISOLATE_SUCCESS:" used to be an empty implementation, then statements got added, but semicolon not removed.
Quoted 26 lines · Vlastimil Babka
Quoted 25 lines · David Hildenbrand
Quoted 15 lines · On 14.10.20 09:23, [email protected] wrote:
From: Yanfei Xu <[email protected]>
start_pfnhas been declared at the begin ofcompact_zone(), it's no need to declare it again. And remove an useless semicolon.Signed-off-by Yanfei Xu <[email protected]>---
mm/compaction.c | 3 +--1 file changed, 1 insertion(+), 2 deletions(-)mm/compaction.c +0
-0mm/compaction.c compact_zone(struct compact_control *cc, struct · line 2276
Quoted 6 lines
mm/compaction.c +1
-1@@ -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; + start_pfn = cc->migrate_pfn;There is a user in
Quoted 7 lines
Quoted 4 lines
trace_mm_compaction_end(start_pfn, cc->migrate_pfn, cc->free_pfn, end_pfn, sync, ret);we would now trace a different value, no?
Agreed. We should rather rename the while-local one to avoid confusion. Something like "
iteration_start_pfn" ?
Thank you, David and Vlastimil, for pointing out the impact to the tracepoint. I think "iteration_start_pfn" is appropriate and will send V2.
Quoted 12 lines
Quoted 11 lines
Quoted 9 lines
mm/compaction.c +0
-0/** Avoid multiple rescans which can happen if a page cannot be @@ -2309,7 +2309,6 @@ compact_zone(struct compact_control *cc, struct capture_control *capc)case
ISOLATE_SUCCESS:
update_cached= false;
last_migrated_pfn=start_pfn;
- ;Huh, how does something like that happen :)
Quoted 1 line
Looks like "case
ISOLATE_SUCCESS:" used to be an empty implementation, then statements got added, but semicolon not removed.
Yup, this case used to be an empty.