Messages in this thread | | | Date | Wed, 1 Dec 2021 19:34:08 -0800 | From | Andrew Morton <> | Subject | Re: [PATCH] mm: fix the type of a parameter |
| |
On Thu, 2 Dec 2021 02:12:36 +0800 Yixuan Cao <caoyixuan2019@email.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.
| |