Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2860766pxk; Sun, 20 Sep 2020 21:07:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSktcpaTzKKV80EZNylFoSRvXc7iRr+P/3/Pq4y/PRcRlbjGofk5s5a/JESErZ9dmoxkIk X-Received: by 2002:a17:906:b813:: with SMTP id dv19mr47059901ejb.70.1600661262052; Sun, 20 Sep 2020 21:07:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600661262; cv=none; d=google.com; s=arc-20160816; b=PS1/oh1U+WJH6Hr+FLccpUEL1iBX5wgEFYu+schTzo1hNgUTl5Am9+es0bORuSHYCe M5f4DH2kvvDLa3vrflWKOkm+SR8xc70RU1o1xk+Q4KXQkHivxtwC+gdob09Xw9IMAG7S S5cqEchMruag1PODJnlyJFej0aU3CLp3LTQXqGFVKIoCpnpq+AKbP1CiS/Gn3bDGekLP LqqvmEelfFGZJGr+KVvAdU7cCT4lCq4GpdkZQ1UAxGRHwf7HktHy9Um4MH4W0Pf4jJKO FKZYqjGH2N8OXtd6kOjFdIKxwWKp7xMHEhXc4AIfqMNST9AQ3aM0EVWukLro/7CvfGZ5 N93w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=7HqDXYNypdPay4qaYqQP43IaZV0bfKPYvVRKk1ByK3A=; b=mZ+SHm5CJPkXvOYLzTBljYtqIneOOCVINTQT8HNrqqzP95rB5KVfZ1CYxXpwSIwFJz 2J08OiSZHGCw/zjN/Gw7jmrmVyTyWYs3OFq+Jqrk2tMeLAbQA219X4MgqaGxbofMQhkS Wg9MxVf3OdeYnQmCIWsRE3r+3nohDg0QQNicd+CsolUM2BBHv9ZOSSiLYDGvLm2YlZG3 BTmM1dY5Dcwq4YQOww4AesHg8M8/C+tFpht32oeNkwcY6YFiyeMC6CH5Gfuqsy5jdP4x giI42Q0HVCRI3v/op6uJ8KfdioaPqhnmbpgurU7H//uVd72lkDIJmeA5vFrkRoakbaEO ONXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y2si7660803edp.120.2020.09.20.21.07.05; Sun, 20 Sep 2020 21:07:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726210AbgIUEEU (ORCPT + 99 others); Mon, 21 Sep 2020 00:04:20 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:56315 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726011AbgIUEEU (ORCPT ); Mon, 21 Sep 2020 00:04:20 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R601e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04420;MF=richard.weiyang@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0U9XRxlZ_1600661057; Received: from localhost(mailfrom:richard.weiyang@linux.alibaba.com fp:SMTPD_---0U9XRxlZ_1600661057) by smtp.aliyun-inc.com(127.0.0.1); Mon, 21 Sep 2020 12:04:17 +0800 From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Wei Yang Subject: [PATCH] mm/mempolicy: remove or narrow the lock on current Date: Mon, 21 Sep 2020 12:04:16 +0800 Message-Id: <20200921040416.86185-1-richard.weiyang@linux.alibaba.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is not necessary to hold the lock of current when setting nodemask of a new policy. Signed-off-by: Wei Yang --- mm/mempolicy.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 906adc58d86f..3fde772ef5ef 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -875,13 +875,12 @@ static long do_set_mempolicy(unsigned short mode, unsigned short flags, goto out; } - task_lock(current); ret = mpol_set_nodemask(new, nodes, scratch); if (ret) { - task_unlock(current); mpol_put(new); goto out; } + task_lock(current); old = current->mempolicy; current->mempolicy = new; if (new && new->mode == MPOL_INTERLEAVE) @@ -1324,9 +1323,7 @@ static long do_mbind(unsigned long start, unsigned long len, NODEMASK_SCRATCH(scratch); if (scratch) { mmap_write_lock(mm); - task_lock(current); err = mpol_set_nodemask(new, nmask, scratch); - task_unlock(current); if (err) mmap_write_unlock(mm); } else -- 2.20.1 (Apple Git-117)