linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Andrew Morton <akpm@linux-foundation.org>,
	Christian Brauner <christian@brauner.io>
Cc: Linux Next Mailing List <linux-next@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrea Arcangeli <aarcange@redhat.com>
Subject: linux-next: manual merge of the akpm-current tree with the pidfd tree
Date: Tue, 23 Apr 2019 18:46:57 +1000	[thread overview]
Message-ID: <20190423184657.3d16ba97@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 2894 bytes --]

Hi all,

Today's linux-next merge of the akpm-current tree got a conflict in:

  kernel/fork.c

between commit:

  2897d468ea48 ("clone: add CLONE_PIDFD")

from the pidfd tree and commit:

  83e1afab81ac ("userfaultfd: use RCU to free the task struct when fork fails")

from the akpm-current tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc kernel/fork.c
index ad2896dd8df2,1c10a912b9b6..000000000000
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@@ -1667,58 -1673,24 +1678,76 @@@ static inline void rcu_copy_process(str
  #endif /* #ifdef CONFIG_TASKS_RCU */
  }
  
 +static int pidfd_release(struct inode *inode, struct file *file)
 +{
 +	struct pid *pid = file->private_data;
 +
 +	file->private_data = NULL;
 +	put_pid(pid);
 +	return 0;
 +}
 +
 +#ifdef CONFIG_PROC_FS
 +static void pidfd_show_fdinfo(struct seq_file *m, struct file *f)
 +{
 +	struct pid_namespace *ns = proc_pid_ns(file_inode(m->file));
 +	struct pid *pid = f->private_data;
 +
 +	seq_put_decimal_ull(m, "Pid:\t", pid_nr_ns(pid, ns));
 +	seq_putc(m, '\n');
 +}
 +#endif
 +
 +const struct file_operations pidfd_fops = {
 +	.release = pidfd_release,
 +#ifdef CONFIG_PROC_FS
 +	.show_fdinfo = pidfd_show_fdinfo,
 +#endif
 +};
 +
 +/**
 + * pidfd_create() - Create a new pid file descriptor.
 + *
 + * @pid:  struct pid that the pidfd will reference
 + *
 + * This creates a new pid file descriptor with the O_CLOEXEC flag set.
 + *
 + * Note, that this function can only be called after the fd table has
 + * been unshared to avoid leaking the pidfd to the new process.
 + *
 + * Return: On success, a cloexec pidfd is returned.
 + *         On error, a negative errno number will be returned.
 + */
 +static int pidfd_create(struct pid *pid)
 +{
 +	int fd;
 +
 +	fd = anon_inode_getfd("[pidfd]", &pidfd_fops, get_pid(pid),
 +			      O_RDWR | O_CLOEXEC);
 +	if (fd < 0)
 +		put_pid(pid);
 +
 +	return fd;
 +}
 +
+ #ifdef CONFIG_MEMCG
+ static void __delayed_free_task(struct rcu_head *rhp)
+ {
+ 	struct task_struct *tsk = container_of(rhp, struct task_struct, rcu);
+ 
+ 	free_task(tsk);
+ }
+ #endif /* CONFIG_MEMCG */
+ 
+ static __always_inline void delayed_free_task(struct task_struct *tsk)
+ {
+ #ifdef CONFIG_MEMCG
+ 	call_rcu(&tsk->rcu, __delayed_free_task);
+ #else /* CONFIG_MEMCG */
+ 	free_task(tsk);
+ #endif /* CONFIG_MEMCG */
+ }
+ 
  /*
   * This creates a new process as a copy of the old one,
   * but does not actually start it yet.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2019-04-23  8:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-23  8:46 Stephen Rothwell [this message]
2019-05-15  3:16 linux-next: manual merge of the akpm-current tree with the pidfd tree Stephen Rothwell
2019-07-08  2:01 ` Stephen Rothwell
2019-07-12 12:53   ` Joel Fernandes
2019-07-12 13:02     ` Christian Brauner
2019-07-12 13:54       ` Joel Fernandes
2019-05-22  1:43 Stephen Rothwell
2019-05-24  8:15 ` Joel Fernandes
2019-07-08 23:12 ` Stephen Rothwell
2020-09-22  8:54 Stephen Rothwell
2021-01-27 11:43 Stephen Rothwell
2021-01-28  2:04 ` Miaohe Lin
2021-02-14 21:54 ` Stephen Rothwell
2021-02-24 22:41   ` Stephen Rothwell

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=20190423184657.3d16ba97@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=christian@brauner.io \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.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 NNTP newsgroup(s).