From: Andrew Morton <akpm@linux-foundation.org>
To: Yixuan Cao <caoyixuan2019@email.szu.edu.cn>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: fix the type of a parameter
Date: Wed, 1 Dec 2021 19:34:08 -0800 [thread overview]
Message-ID: <20211201193408.49c88f8281d14fb2c61f9ee6@linux-foundation.org> (raw)
In-Reply-To: <20211201181236.2315-1-caoyixuan2019@email.szu.edu.cn>
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.
next prev parent reply other threads:[~2021-12-02 3:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-01 18:12 Yixuan Cao
2021-12-02 3:34 ` Andrew Morton [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-11-25 19:43 Yixuan Cao
2021-11-25 20:28 ` Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211201193408.49c88f8281d14fb2c61f9ee6@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=caoyixuan2019@email.szu.edu.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox