Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3727373ybl; Mon, 27 Jan 2020 09:16:10 -0800 (PST) X-Google-Smtp-Source: APXvYqxSifW+wSQxJYiFMbxQasHDGSdoo3z54OV4p5wpWqZ6Wzeu1AUpq1rKwMKH9tKamSI6ne/D X-Received: by 2002:aca:458:: with SMTP id 85mr83617oie.56.1580145370644; Mon, 27 Jan 2020 09:16:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580145370; cv=none; d=google.com; s=arc-20160816; b=CYnEkGRQPo7hQ+oYTawcpv5pC5Nz3g/JQbVINEH6AnuRum7J1eNKpEdMfqI8iezjct HogWd89xYwyBN7CdGDy4vCcmM0j610aTrDZN0WYqYb3CqJUaHZ86evwIy9mjR2PqfM1k jc5lOZ3x7KuUPeE9KLwGXBY/HheLRZrUaI/QInxKmO7hr1HYlNAW8wqgx/Lnn2YbkiUM L6px63Va9p3kAeSP96qdJ0KitOj++15PN8KEefzCEB01ZtHlJ0GQWjAMaityAPP1Ekw5 wCLuJh05R+ST8TIJ8DJ0Box11W2+VaGSeqVKO2M7HTpfBQga+D7fMQFcBV+kzFbCVvbt 5iDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature; bh=pf0S3I7vm4DQQ+rPfSSMEtOHhIykr+8LjXy2v0z/gKo=; b=PpjLSF9WPoUKFCousiRnjsMyqto4oPMB6acpoHVeokAtB5M5u8Cg+JW2U6rcJ/UiBB JgOucp0JdWFY/60esDpriMe81Ji7UQsmahhAkqy8iy4vCrMk+lvAd5L5tVg1FEqTUUlq j3tH/QZ+2nFT7QF8N4YnCQ/0a+STeAwEkf7adOEdiwrYWEBMwNeAP8GGixniC5ugM/H4 2BmDLC5CClT3koLsaG0F29ts/IbnGyvqz2qfjdXEpkgdrWcB/IfTWhnj04m7pEh3f0Ee spIFOb0xiMlkeAcYvDsZTSgU6u7sa07zEKa/6GTooS/mRIW7k7wdSWogiTlbtOQyFu7Y ryWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ADlD8+7A; 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 7si1463384oij.29.2020.01.27.09.15.57; Mon, 27 Jan 2020 09:16:10 -0800 (PST) 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=ADlD8+7A; 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 S1726083AbgA0RPE (ORCPT + 99 others); Mon, 27 Jan 2020 12:15:04 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:43706 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725828AbgA0RPD (ORCPT ); Mon, 27 Jan 2020 12:15:03 -0500 Received: by mail-pl1-f194.google.com with SMTP id p11so230018plq.10; Mon, 27 Jan 2020 09:15:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=pf0S3I7vm4DQQ+rPfSSMEtOHhIykr+8LjXy2v0z/gKo=; b=ADlD8+7AhV4HzY3kn3Ja8H1Ycseuc28mPYXZZ/eAyrR62S2ZsMjPrTBwJ+SSgxsiri efC5T5z3CfQONzDAsBLjN5sJEgqIRYExedglJcFORykliKnmEAqMBDFBPDFENgjgtums HOWaeM626innmksq7XKDCb+WCnXvY6NTUm7bBmdCx42Ie0QIrvueia5inIIGcnpz8uGC 9qpepbRm32bWkk18JtnCnBBiecFn4dBG0JxAYQPleKK6IrQaQuvZvw1YK+oJEwjkSmty 9FqQ6NHPzrJQm3ioPl//09wv612aAK5LCsIZOH3T8T2SamMky43OEMz7mcQa6Pu3XBZS vwJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=pf0S3I7vm4DQQ+rPfSSMEtOHhIykr+8LjXy2v0z/gKo=; b=KTATdu9h0ybcKUWsGaX8AsZczE+g9F9/UpTHEyfcBkVbpoeNe6cKViFYZmNTniYt3R AZmspiM+XlUqQjVMcayXSTLQ+t82rbeBFiok8DVzz+3tkk8okOt4EYQujmwNCbMhNh9L 7fsL3c6Ym2M66sHzMwYCRYC+xIJFbvPL+9Z1GKn3zjIliJB45Q0LHuMoxAIZxqaHnVk8 a+bC47RLwdo5qz+WB7X7uiIFyFXqW1SiUCYewSdRbPS5E5REnjeDIabNfGaaRTPwlS3c /PcSzFH36+hmFPDEI+0b31GwsS/PNLqSUDH8KTKaXPW593T7I9zddg0sPhnr+LGB+4+a ehSA== X-Gm-Message-State: APjAAAU97S+YERNCExcyz9N5BLxvjoQQ94Nbwpb8kpTCWYjzXnx/Phvt dFGMlnvvmtNpVEEJ2ycVBw== X-Received: by 2002:a17:902:ff11:: with SMTP id f17mr18053213plj.273.1580145302885; Mon, 27 Jan 2020 09:15:02 -0800 (PST) Received: from madhuparna-HP-Notebook ([2402:3a80:1ee2:faa0:c576:b7c8:dab8:85b]) by smtp.gmail.com with ESMTPSA id k9sm16398869pjo.19.2020.01.27.09.14.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jan 2020 09:15:02 -0800 (PST) From: Madhuparna Bhowmik X-Google-Original-From: Madhuparna Bhowmik Date: Mon, 27 Jan 2020 22:44:53 +0530 To: Oleg Nesterov Cc: madhuparnabhowmik10@gmail.com, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, ebiederm@xmission.com, christian.brauner@ubuntu.com, paulmck@kernel.org, joel@joelfernandes.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, frextrite@gmail.com, rcu@vger.kernel.org Subject: Re: [PATCH] sched.h: Annotate sighand_struct with __rcu Message-ID: <20200127171453.GA4002@madhuparna-HP-Notebook> References: <20200124045908.26389-1-madhuparnabhowmik10@gmail.com> <20200127092951.GA1116@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200127092951.GA1116@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 27, 2020 at 10:29:52AM +0100, Oleg Nesterov wrote: > On 01/24, madhuparnabhowmik10@gmail.com wrote: > > > > --- a/include/linux/sched.h > > +++ b/include/linux/sched.h > > @@ -918,7 +918,7 @@ struct task_struct { > > > > /* Signal handlers: */ > > struct signal_struct *signal; > > - struct sighand_struct *sighand; > > + struct sighand_struct __rcu *sighand; > > sigset_t blocked; > > sigset_t real_blocked; > > /* Restored if set_restore_sigmask() was used: */ > > diff --git a/kernel/signal.c b/kernel/signal.c > > index bcd46f547db3..9ad8dea93dbb 100644 > > --- a/kernel/signal.c > > +++ b/kernel/signal.c > > @@ -1383,7 +1383,7 @@ struct sighand_struct *__lock_task_sighand(struct task_struct *tsk, > > * must see ->sighand == NULL. > > */ > > spin_lock_irqsave(&sighand->siglock, *flags); > > - if (likely(sighand == tsk->sighand)) > > + if (likely(sighand == rcu_access_pointer(tsk->sighand))) > > break; > > spin_unlock_irqrestore(&sighand->siglock, *flags); > > } > > ACK, > > perhaps you can also cleanup copy_sighand(). rcu_assign_pointer() makes no > sense, we should either move it down or simply use RCU_INIT_POINTER(). > Sure, I will do it and send a patch soon. Thank you, Madhuparna > Oleg. >