Linux MM tree latest commits
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: akpm@linux-foundation.org
Cc: axboe@kernel.dk, krisman@collabora.com, legion@kernel.org,
	mm-commits@vger.kernel.org, peterz@infradead.org,
	ran.xiaokai@zte.com.cn
Subject: Re: + unshare-use-swap-to-make-code-cleaner.patch added to -mm tree
Date: Wed, 15 Sep 2021 08:20:44 -0500	[thread overview]
Message-ID: <8735q6c6vn.fsf@disp2133> (raw)
In-Reply-To: <20210915035327.38DUnaS_8%akpm@linux-foundation.org> (akpm's message of "Tue, 14 Sep 2021 20:53:27 -0700")

akpm@linux-foundation.org writes:

> The patch titled
>      Subject: kernel/fork.c: unshare(): use swap() to make code cleaner
> has been added to the -mm tree.  Its filename is
>      unshare-use-swap-to-make-code-cleaner.patch
>
> This patch should soon appear at
>     https://ozlabs.org/~akpm/mmots/broken-out/unshare-use-swap-to-make-code-cleaner.patch
> and later at
>     https://ozlabs.org/~akpm/mmotm/broken-out/unshare-use-swap-to-make-code-cleaner.patch
>
> Before you just go and hit "reply", please:
>    a) Consider who else should be cc'ed
>    b) Prefer to cc a suitable mailing list as well
>    c) Ideally: find the original patch on the mailing list and do a
>       reply-to-all to that, adding suitable additional cc's
>
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
>
> The -mm tree is included into linux-next and is updated
> there every 3-4 working days

Why is the swap macro spelled in lower case?

Given that there is no way to write swap as a function I would think we
would want to write SWAP instead of swap to make it clear swap is a
macro.

Eric


> ------------------------------------------------------
> From: Ran Xiaokai <ran.xiaokai@zte.com.cn>
> Subject: kernel/fork.c: unshare(): use swap() to make code cleaner
>
> Use swap() instead of reimplementing it.
>
> Link: https://lkml.kernel.org/r/20210909022046.8151-1-ran.xiaokai@zte.com.cn
> Signed-off-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>
> Cc: Gabriel Krisman Bertazi <krisman@collabora.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Eric W. Biederman <ebiederm@xmission.com>
> Cc: Jens Axboe <axboe@kernel.dk>
> Cc: Alexey Gladkov <legion@kernel.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
>  kernel/fork.c |    9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> --- a/kernel/fork.c~unshare-use-swap-to-make-code-cleaner
> +++ a/kernel/fork.c
> @@ -3078,7 +3078,7 @@ int unshare_fd(unsigned long unshare_fla
>  int ksys_unshare(unsigned long unshare_flags)
>  {
>  	struct fs_struct *fs, *new_fs = NULL;
> -	struct files_struct *fd, *new_fd = NULL;
> +	struct files_struct *new_fd = NULL;
>  	struct cred *new_cred = NULL;
>  	struct nsproxy *new_nsproxy = NULL;
>  	int do_sysvsem = 0;
> @@ -3165,11 +3165,8 @@ int ksys_unshare(unsigned long unshare_f
>  			spin_unlock(&fs->lock);
>  		}
>  
> -		if (new_fd) {
> -			fd = current->files;
> -			current->files = new_fd;
> -			new_fd = fd;
> -		}
> +		if (new_fd)
> +			swap(current->files, new_fd);
>  
>  		task_unlock(current);
>  
> _
>
> Patches currently in -mm which might be from ran.xiaokai@zte.com.cn are
>
> unshare-use-swap-to-make-code-cleaner.patch

  reply	other threads:[~2021-09-15 13:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15  3:53 + unshare-use-swap-to-make-code-cleaner.patch added to -mm tree akpm
2021-09-15 13:20 ` Eric W. Biederman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-09-15  3:53 akpm

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=8735q6c6vn.fsf@disp2133 \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=krisman@collabora.com \
    --cc=legion@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=ran.xiaokai@zte.com.cn \
    /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