lkml.org 
[lkml]   [2021]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.

\
 
 \ /
  Last update: 2021-12-02 04:35    [W:0.043 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site