From: John Hubbard <jhubbard@nvidia.com>
To: Mike Rapoport <rppt@linux.ibm.com>, Nadav Amit <nadav.amit@gmail.com>
Cc: David Hildenbrand <david@redhat.com>,
Peter Xu <peterx@redhat.com>, Linux MM <linux-mm@kvack.org>,
Mike Kravetz <mike.kravetz@oracle.com>,
Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Axel Rasmussen <axelrasmussen@google.com>
Subject: Re: [PATCH RFC] userfaultfd: introduce UFFDIO_COPY_MODE_YOUNG
Date: Tue, 14 Jun 2022 13:40:18 -0700 [thread overview]
Message-ID: <481fc9d0-6122-bf59-9d04-23c10d256764@nvidia.com> (raw)
In-Reply-To: <YqjZywZfkV+CiM29@linux.ibm.com>
On 6/14/22 11:56, Mike Rapoport wrote:
>> But, I cannot take it anymore: the list of arguments for uffd stuff is
>> crazy. I would like to collect all the possible arguments that are used for
>> uffd operation into some “struct uffd_op”.
>
> Squashing boolean parameters into int flags will also reduce the insane
> amount of parameters. No strong feelings though.
>
Just a quick drive-by comment about boolean arguments: they ruin the
readability of the call sites. In practice, sometimes a single boolean
argument can be OK-ish (still poor to read at the call site, but easier
to code initially), but once you get past one boolean argument in the
function, readability is hopeless:
foo(ptr, true, false, a == b);
So if you have a choice, I implore you to prefer flags and/or enums. :)
thanks,
--
John Hubbard
NVIDIA
next prev parent reply other threads:[~2022-06-14 20:40 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-13 20:40 Nadav Amit
2022-06-14 15:22 ` David Hildenbrand
2022-06-14 16:18 ` Nadav Amit
2022-06-14 17:14 ` David Hildenbrand
2022-06-14 18:56 ` Mike Rapoport
2022-06-14 19:25 ` Nadav Amit
2022-06-14 20:40 ` John Hubbard [this message]
2022-06-14 20:56 ` Nadav Amit
2022-06-14 21:40 ` John Hubbard
2022-06-14 21:52 ` Nadav Amit
2022-06-14 21:59 ` John Hubbard
2022-06-15 7:26 ` Mike Rapoport
2022-06-15 15:43 ` Peter Xu
2022-06-15 16:58 ` Nadav Amit
2022-06-15 18:39 ` Peter Xu
2022-06-15 19:42 ` Nadav Amit
2022-06-15 20:56 ` Peter Xu
2022-06-16 5:24 ` Nadav Amit
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=481fc9d0-6122-bf59-9d04-23c10d256764@nvidia.com \
--to=jhubbard@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=david@redhat.com \
--cc=hughd@google.com \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=nadav.amit@gmail.com \
--cc=peterx@redhat.com \
--cc=rppt@linux.ibm.com \
/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