From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFD6AC43461 for ; Sun, 13 Sep 2020 16:19:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 847F1221EB for ; Sun, 13 Sep 2020 16:19:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725954AbgIMQTg (ORCPT ); Sun, 13 Sep 2020 12:19:36 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:58072 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725938AbgIMQTa (ORCPT ); Sun, 13 Sep 2020 12:19:30 -0400 Received: from in02.mta.xmission.com ([166.70.13.52]) by out01.mta.xmission.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1kHUih-00514F-NR; Sun, 13 Sep 2020 10:19:15 -0600 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95]:55736 helo=x220.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.87) (envelope-from ) id 1kHUig-0008H6-Jy; Sun, 13 Sep 2020 10:19:15 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Miaohe Lin Cc: , , , , , , , , , , References: <20200913092415.24408-1-linmiaohe@huawei.com> Date: Sun, 13 Sep 2020 11:18:55 -0500 In-Reply-To: <20200913092415.24408-1-linmiaohe@huawei.com> (Miaohe Lin's message of "Sun, 13 Sep 2020 05:24:15 -0400") Message-ID: <87r1r5wsy8.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1kHUig-0008H6-Jy;;;mid=<87r1r5wsy8.fsf@x220.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1/l0hTNb5Jm3CMgXlcvB1n4k4tpgaYsOQo= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: [PATCH] fork: Use helper function mapping_allow_writable() in dup_mmap() X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Miaohe Lin writes: > Use helper function mapping_allow_writable() to atomic_inc > i_mmap_writable. Why? > Signed-off-by: Miaohe Lin > --- > 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,