* + unshare-use-swap-to-make-code-cleaner.patch added to -mm tree
@ 2021-09-15 3:53 akpm
2021-09-15 13:20 ` Eric W. Biederman
0 siblings, 1 reply; 3+ messages in thread
From: akpm @ 2021-09-15 3:53 UTC (permalink / raw)
To: axboe, ebiederm, krisman, legion, mm-commits, peterz, ran.xiaokai
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
------------------------------------------------------
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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: + unshare-use-swap-to-make-code-cleaner.patch added to -mm tree
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
0 siblings, 0 replies; 3+ messages in thread
From: Eric W. Biederman @ 2021-09-15 13:20 UTC (permalink / raw)
To: akpm; +Cc: axboe, krisman, legion, mm-commits, peterz, ran.xiaokai
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* + unshare-use-swap-to-make-code-cleaner.patch added to -mm tree
@ 2021-09-15 3:53 akpm
0 siblings, 0 replies; 3+ messages in thread
From: akpm @ 2021-09-15 3:53 UTC (permalink / raw)
To: mm-commits, ran.xiaokai
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
------------------------------------------------------
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>
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-09-15 13:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
-- strict thread matches above, loose matches on Subject: below --
2021-09-15 3:53 akpm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox