[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20211201193408.49c88f8281d14fb2c61f9ee6@linux-foundation.org>
Date: Wed, 1 Dec 2021 19:34:08 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Yixuan Cao <caoyixuan2019@...il.szu.edu.cn>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: fix the type of a parameter
On Thu, 2 Dec 2021 02:12:36 +0800 Yixuan Cao <caoyixuan2019@...il.szu.edu.cn> wrote:
> The type of "last_migrate_reason" in struct page_owner is short.
> However, the type of "reason" in the argument list of following functions
> __set_page_owner_migrate_reason
> set_page_owner_migrate_reason
>
> is int, which is inconsistent.
Well.
I'd say "no", because `int' is a natural type and the packing of that
scalar into a `short' is an expedient little space-saving hack (ie, an
"implementation detail") which should be hidden from callers rather
than propagated back up the call stack.
However, all these `int's should be of type `enum migrate_reason'. And
the lowest-level hack of stuffing that enum into a `short' should
remain an implementation detail, hidden from callers.
Powered by blists - more mailing lists