From: Gregory Price <gregory.price@memverge.com>
To: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Gregory Price <gourry.memverge@gmail.com>,
linux-mm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arch@vger.kernel.org, linux-api@vger.kernel.org,
linux-cxl@vger.kernel.org, luto@kernel.org, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
hpa@zytor.com, arnd@arndb.de, akpm@linux-foundation.org,
x86@kernel.org
Subject: Re: [RFC PATCH 2/3] mm/mempolicy: Implement set_mempolicy2 and get_mempolicy2 syscalls
Date: Mon, 2 Oct 2023 11:30:42 -0400 [thread overview]
Message-ID: <ZRriIpYETsRdWZet@memverge.com> (raw)
In-Reply-To: <20231002143008.000038ac@Huawei.com>
On Mon, Oct 02, 2023 at 02:30:08PM +0100, Jonathan Cameron wrote:
> On Thu, 14 Sep 2023 19:54:56 -0400
> Gregory Price <gourry.memverge@gmail.com> wrote:
>
> > diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
> > index abe087c53b4b..397dcf804941 100644
> > --- a/include/uapi/asm-generic/unistd.h
> > +++ b/include/uapi/asm-generic/unistd.h
> > ...
> > #undef __NR_syscalls
> > -#define __NR_syscalls 453
> > +#define __NR_syscalls 456
> +3 for 2 additions?
>
When i'd originally written this, there was a partially merged syscall
colliding with 453, and this hadn't been incremented yet. Did a quick
grep and it seems like that might have been reverted, so yeah this would
drop down to 453/454 & __NR=455.
> > + /* Legacy modes are routed through the legacy interface */
> > + if (kargs->mode <= MPOL_LEGACY)
> > + return false;
> > +
> > + if (kargs->mode >= MPOL_MAX)
> > + return false;
> > +
> > + return true;
>
> This is a range check, so I think equally clear (and shorter) as..
> /* Legacy modes are routed through the legacy interface */
> return kargs->mode > MPOL_LEGACY && kargs->mode < MPOL_MAX;
>
I'll combine the range, but i left the two true/false conditions
separate because it's intended that follow on patches will add logic
before true is returned.
> > + kargs->get.allowed.err = err ? err : 0;
> > + kargs->err |= err ? err : 1;
> if (err) {
> kargs->get.allowed.err = err;
> kargs->err |= err;
> } else {
> kargs->get.allowed.err = 0;
> kargs->err = 1;
> Not particularly obvious why 1 and if you get an error later it's going to be messy
> as will 1 |= err_code
My original intent was to just allow each section to error separately,
but honestly this seems overly complicated and somewhat against the
design of almost every other syscall, so i'm going to rip all these
error code spaces out and instead just have everything return on error.
Thanks!
Gregory
next prev parent reply other threads:[~2023-10-02 15:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 23:54 [RFC PATCH 0/3] mm/mempolicy: set/get_mempolicy2 Gregory Price
2023-09-14 23:54 ` [RFC PATCH 1/3] mm/mempolicy: refactor do_set_mempolicy for code re-use Gregory Price
2023-10-02 11:03 ` Jonathan Cameron
2023-09-14 23:54 ` [RFC PATCH 2/3] mm/mempolicy: Implement set_mempolicy2 and get_mempolicy2 syscalls Gregory Price
2023-10-02 13:30 ` Jonathan Cameron
2023-10-02 15:30 ` Gregory Price [this message]
2023-10-02 18:03 ` Gregory Price
2023-09-14 23:54 ` [RFC PATCH 3/3] mm/mempolicy: implement a partial-interleave mempolicy Gregory Price
2023-10-02 13:40 ` Jonathan Cameron
2023-10-02 16:10 ` Gregory Price
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=ZRriIpYETsRdWZet@memverge.com \
--to=gregory.price@memverge.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=gourry.memverge@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).