Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2604586ybh; Mon, 16 Mar 2020 06:26:36 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtHAqG416Em38yQZ9KAcJ+MX5Kniv/prEnVxuApPTvK3v/OkdxfV1XnY6w97xtV1P0JD8N1 X-Received: by 2002:a05:6808:3d0:: with SMTP id o16mr16268236oie.12.1584365196144; Mon, 16 Mar 2020 06:26:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584365196; cv=none; d=google.com; s=arc-20160816; b=IhewmJL69TOgPl0QYVJSUTP1eWT+5zHE0AnRNwI2kDCuMum7o3zJqA742dQmmOFibG aVC8Hepk6zl/nkHTDPlXVr15Mp3GWBSsGoPXjnceLJLdk38XIAQJoZ4MWPILlUsAlwa9 BGVoj/i29GdNhNbKYwfbGYrQr8SVyPcSyKEiupw4vuqZC+UQK97e/Bmzd9tTYqsR5nJQ rS6dtn4QuczwwQyATS/SY7LsPC0t1V4f0JlU6DHYCpSQGGF6qFV4HbW0dUuhc4FsH8kV ve2xj+vQtmDF919vPfRrcyTgkst6diZ5fMN0GU3kjYmLX08oOyvDRVQskcvJrBRIalNd O4Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=TMB3I+rumZbopL7iA7VgSh6g4RCIDOU1fcM/KqObKVk=; b=PmWV0J331hiW+5DzAKd/vTcheQhvjggTwYB9cz6DZnXiGsOKY/XiTbZiQbintcqDtd 30+zzIYsC4OojsG5V7nro61G0IXgilQaJfRRzwHAw6aeASxyiCGq/5TeesNCC3Zkua4U IPCg/8LGu/iyHMOd1rbGa+rfX8iEzO+JqQBS39TURc4g7tFPyN1j74/X7ibk1Mm/rYIt kjf7bIoQ6TmJLOPDFAbKoomwLCYn3BghM6r1TRcWXs0/ehNyoNM9fqF+w/Kd7bP4XVSK atDCAY6rnMnW9BVaNTnCK/VD5bOu3W3htIae+/iRWJbAKu7UDPCd9cojpPoK64G5MSe/ h9XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lbH43ppH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q27si8007184otc.310.2020.03.16.06.26.21; Mon, 16 Mar 2020 06:26:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lbH43ppH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731344AbgCPNZW (ORCPT + 99 others); Mon, 16 Mar 2020 09:25:22 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:36496 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731339AbgCPNZV (ORCPT ); Mon, 16 Mar 2020 09:25:21 -0400 Received: by mail-io1-f66.google.com with SMTP id d15so17096527iog.3 for ; Mon, 16 Mar 2020 06:25:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=TMB3I+rumZbopL7iA7VgSh6g4RCIDOU1fcM/KqObKVk=; b=lbH43ppHwZ+4bP9DpdgMlJd10QGcbF3VkZgARIIwmPAabLVrq89yo59Wkvpg0B+FOr LKkDkwn+A+RlzmNcjdQlpN7WocV+dq/bcnczJqSsY+gFWs1g1z25MUdZ4acX7Xi2qhnY GFcS6BbZK+K/Pq2RQybjP9tmkujzmaWDwsSQjNzycd2QY8mMVXfKpDJNLgwvqkF8Jots y9XZQvsztYs3SfIodSB1ESokwzOAjrGuQ8mADrY+a4GcxmUjhLhBU/KJ4qDmdOQg3JC8 Y0W+05I4f8zp/7HcEsYZAQhZQZBv37waLj8MV+UHtcoo45uXd4mz2gkYJX+xLQmMtdiE U21w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=TMB3I+rumZbopL7iA7VgSh6g4RCIDOU1fcM/KqObKVk=; b=iDZl33Hpb9lIzBMixBtccxDcq1txVBLp+mw0ylmRBHayxcKhmloaZnxVrI5PjUSERW Tu6XXJQl2EXaBCE+Vo+mfGqlVWTQ23dijRzT/mLIZ7NLsegMgpDuyC5AdvOk2cKtn6oJ pafH8bO55LbSDx4PBUH2xqh0e2G+UN5EO8VKPty8UsbLlZj0ButZBvRMAtr23CtCgvl2 w6V0B6UopZLkobTsYGzX1QJjGM404OEkk6jdua3nF+K6kL9IBdTXFoMzWhTIsmDHyVY9 6zV/rU+/bQlKfMfN0Fet1+OoPDzlJ2CWK7AvT7p7gs9p9Blvxo6/2f9Kb/O4hMgoeNMv j+rQ== X-Gm-Message-State: ANhLgQ1YnzukmE9+ezVMjjuD/fVBa3uybCy1ldzPmnO75UxnNJ4EDCiF kvhXZP5g9du4Ns6Xt/vQo7O/PwjpvAuMA6Fp2GCQ5x9O X-Received: by 2002:a02:81cd:: with SMTP id r13mr9442364jag.91.1584365120586; Mon, 16 Mar 2020 06:25:20 -0700 (PDT) MIME-Version: 1.0 References: <20200313031017.71090-1-ling.ma.program@gmail.com> In-Reply-To: <20200313031017.71090-1-ling.ma.program@gmail.com> From: Ling Ma Date: Mon, 16 Mar 2020 21:25:42 +0800 Message-ID: Subject: Re: [RFC PATCH] locks:Remove spinlock in unshare_files To: linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar Cc: "ling.ma" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Any comments ? Thanks Ling =E4=BA=8E2020=E5=B9=B43=E6=9C=8813=E6=97=A5=E5= =91=A8=E4=BA=94 =E4=B8=8A=E5=8D=8811:09=E5=86=99=E9=81=93=EF=BC=9A > > From: Ma Ling > > Processor support atomic operation for long/int/short/char type, > we use the feature to avoid spinlock, which cost hundreds cycles. > > Appreciate your comments > Ling > > Signed-off-by: Ma Ling > --- > kernel/fork.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/kernel/fork.c b/kernel/fork.c > index 60a1295..fe54600 100644 > --- a/kernel/fork.c > +++ b/kernel/fork.c > @@ -3041,9 +3041,7 @@ int unshare_files(struct files_struct **displaced) > return error; > } > *displaced =3D task->files; > - task_lock(task); > - task->files =3D copy; > - task_unlock(task); > + WRITE_ONCE(task->files, copy); > return 0; > } > > -- > 1.8.3.1 >