Re: [PATCH] mm/compaction: Remove some useless code in compact_zone()

From: David Hildenbrand
Date: Wed Oct 14 2020 - 08:28:39 EST


On 14.10.20 09:23, yanfei.xu@xxxxxxxxxxxxx wrote:
> From: Yanfei Xu <yanfei.xu@xxxxxxxxxxxxx>
>
> start_pfn has been declared at the begin of compact_zone(), it's
> no need to declare it again. And remove an useless semicolon.
>
> Signed-off-by: Yanfei Xu <yanfei.xu@xxxxxxxxxxxxx>
> ---
> mm/compaction.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/mm/compaction.c b/mm/compaction.c
> index 176dcded298e..5e69c1f94d96 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;
> + 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?

>
> /*
> * 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 :)

--
Thanks,

David / dhildenb