linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Linus Torvalds' <torvalds@linux-foundation.org>,
	Christian Brauner <brauner@kernel.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [GIT PULL] pidfd updates
Date: Fri, 28 Apr 2023 08:40:31 +0000	[thread overview]
Message-ID: <eb05bc4e50464579a60b80ddfd596a6a@AcuMS.aculab.com> (raw)
In-Reply-To: <CAHk-=wjpBq2D97ih_AA0D7+KJ8ihT6WW_cn1BQc43wVgUioH2w@mail.gmail.com>

From: Linus Torvalds
> Sent: 25 April 2023 17:29
> 
> On Tue, Apr 25, 2023 at 5:34 AM Christian Brauner <brauner@kernel.org> wrote:
> >
> > Hell, you could even extend that proposal below to wrap the
> > put_user()...
> >
> > struct fd_file {
> >         struct file *file;
> >         int fd;
> >         int __user *fd_user;
> > };
> 
> So I don't like this extended version, but your proposal patch below
> looks good to me.
> 
> Why? Simply because the "two-word struct" is actually a good way to
> return two values. But a three-word one would be passed on the stack.
> 
> Both gcc and clang return small structs (where "small" is literally
> just two words) in registers, and it's part of most (all?) ABIs and
> we've relied on that before.

It is definitely architecture dependant.
x86-64 and arm-64 will return two 64bit values in registers.
x86-32 and arm-32 return two 32bit values on stack.

Pretty much everything passes short structures directly by value.
(I'm not sure about sparc-32 though, I'm sure it passed all
structures by reference back in the 1980s)

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

  parent reply	other threads:[~2023-04-28  8:40 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-21 13:41 [GIT PULL] pidfd updates Christian Brauner
2023-04-24 20:24 ` Linus Torvalds
2023-04-24 20:35   ` Linus Torvalds
2023-04-25 12:08     ` Christian Brauner
2023-04-25  6:04   ` Al Viro
2023-04-25 12:34     ` Christian Brauner
2023-04-25 13:54       ` Al Viro
2023-04-25 14:36         ` Christian Brauner
2023-04-25 15:48           ` Al Viro
2023-04-25 16:28       ` Linus Torvalds
2023-04-25 17:19         ` Al Viro
2023-04-28  8:40         ` David Laight [this message]
2023-04-28 18:26           ` Linus Torvalds
2023-04-27  1:07       ` Al Viro
2023-04-27  7:39         ` Al Viro
2023-04-27  8:33           ` Christian Brauner
2023-04-27  8:59             ` Al Viro
2023-04-27  9:40               ` Christian Brauner
2023-04-27 15:21           ` Linus Torvalds
2023-04-27 17:02             ` Al Viro
2023-05-02  7:11               ` Christian Brauner
2023-04-27  8:11         ` Christian Brauner
2023-04-24 21:45 ` pr-tracker-bot

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=eb05bc4e50464579a60b80ddfd596a6a@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 NNTP newsgroup(s).