All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fork: Use helper function mapping_allow_writable() in dup_mmap()
@ 2020-09-13  9:24 Miaohe Lin
  2020-09-13 16:18 ` Eric W. Biederman
  2020-09-15 15:47 ` Christian Brauner
  0 siblings, 2 replies; 7+ messages in thread
From: Miaohe Lin @ 2020-09-13  9:24 UTC (permalink / raw)
  To: christian.brauner, akpm, peterz, mingo, ebiederm, christian,
	surenb, areber, shakeelb, cyphar, tglx
  Cc: linux-kernel, linmiaohe

Use helper function mapping_allow_writable() to atomic_inc i_mmap_writable.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 kernel/fork.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 4b328aecabb2..a0586716e327 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -558,7 +558,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
 				atomic_dec(&inode->i_writecount);
 			i_mmap_lock_write(mapping);
 			if (tmp->vm_flags & VM_SHARED)
-				atomic_inc(&mapping->i_mmap_writable);
+				mapping_allow_writable(mapping);
 			flush_dcache_mmap_lock(mapping);
 			/* insert tmp into the share list, just after mpnt */
 			vma_interval_tree_insert_after(tmp, mpnt,
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* Re: [PATCH] fork: Use helper function mapping_allow_writable() in dup_mmap()
@ 2020-09-14  1:38 linmiaohe
  2020-09-14 12:03 ` Eric W. Biederman
  0 siblings, 1 reply; 7+ messages in thread
From: linmiaohe @ 2020-09-14  1:38 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: christian.brauner, akpm, peterz, mingo, christian, surenb,
	areber, shakeelb, cyphar, tglx, linux-kernel

Eric W. Biederman <ebiederm@xmission.com> wrote:
> Miaohe Lin <linmiaohe@huawei.com> writes:
>
>> Use helper function mapping_allow_writable() to atomic_inc 
>> i_mmap_writable.
>
>Why?
>

Because I think it's better to use the wrapper function instead of the open hard code.
Thanks.


^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [PATCH] fork: Use helper function mapping_allow_writable() in dup_mmap()
@ 2020-09-15  9:25 linmiaohe
  0 siblings, 0 replies; 7+ messages in thread
From: linmiaohe @ 2020-09-15  9:25 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: christian.brauner, akpm, peterz, mingo, christian, surenb,
	areber, shakeelb, cyphar, tglx, linux-kernel

Eric W. Biederman <ebiederm@xmission.com> wrote:
> linmiaohe <linmiaohe@huawei.com> writes:
>> Eric W. Biederman <ebiederm@xmission.com> wrote:
>>> Miaohe Lin <linmiaohe@huawei.com> writes:
>>>
>>>> Use helper function mapping_allow_writable() to atomic_inc 
>>>> i_mmap_writable.
>>>
>>>Why?
>>>
>>
>> Because I think it's better to use the wrapper function instead of the 
>> open hard code.
>
>My point is there is no context in this commit message.
>
>What makes it better to use the wrapper function?
>What makes the wrapper function the appropriate function to use?
>Why just this location?
>Why wasn't this change made when the wrapper function was introduced?
>
>I could probably read through the code and figure these things out but the description of the change should really include these things.
>
>Eric

I see. Many thanks for your detailed explaination. :)


^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [PATCH] fork: Use helper function mapping_allow_writable() in dup_mmap()
@ 2020-09-16  1:39 linmiaohe
  0 siblings, 0 replies; 7+ messages in thread
From: linmiaohe @ 2020-09-16  1:39 UTC (permalink / raw)
  To: Christian Brauner
  Cc: akpm, peterz, mingo, ebiederm, christian, surenb, areber,
	shakeelb, cyphar, tglx, linux-kernel

Christian Brauner <christian.brauner@ubuntu.com> wrote:
> On Sun, Sep 13, 2020 at 05:24:15AM -0400, Miaohe Lin wrote:
>> Use helper function mapping_allow_writable() to atomic_inc i_mmap_writable.
>> 
>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
>> ---
>
>Hey Miaohe,
>
>Thanks for the patch!
>Per se there's nothing against using a proper helper when it exists.
>But it has already been pointed out that this needs a proper commit message with more rationale. But I'm otherwise happy to take this.
>

Many thanks for your reply.
Eric have kindly pointed this out. I think I should provide a proper commit message with more rationale in v2.
Thanks again.

>Thanks!
>Christian

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-09-16  1:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-13  9:24 [PATCH] fork: Use helper function mapping_allow_writable() in dup_mmap() Miaohe Lin
2020-09-13 16:18 ` Eric W. Biederman
2020-09-15 15:47 ` Christian Brauner
2020-09-14  1:38 linmiaohe
2020-09-14 12:03 ` Eric W. Biederman
2020-09-15  9:25 linmiaohe
2020-09-16  1:39 linmiaohe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.