Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp102012ybm; Wed, 27 May 2020 20:47:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKKCNWiFQ8CHn63pgJ8zgj0n08uDnUG9JPOZL9uL5Mqn4rtTltDlLtdPsTdToHBXNIb/Uw X-Received: by 2002:a50:cdd8:: with SMTP id h24mr1126061edj.260.1590637678299; Wed, 27 May 2020 20:47:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590637678; cv=none; d=google.com; s=arc-20160816; b=U5jf/ePOJ5Pl72+MnXsiVxKXiI8efS5cmxzrKmTg6ZUKCxloQ5D7YHdaNWfs9AZTjq jzF08TQKu4wtqK9dWrCrMhunb8EUUW+MRlHgkxb7vKTHbygvpgCS14NHRvqTSKMQ0/hY dqnGg2dtszJfxgbdto4X4vziDILXgPiPCwQtpLuXfk/l2jTF+I9ngXchb2NQwtslCQ7A aimdsMv03FIpkIEZLGZaJpKsnG/awq+llXuAy6rj1VDgMauvI618nZvkLu0pge0gQdPN bRbt6Wo+9k4+IWh1Zv9W5QFgnMX9oMYg+sy+hHqP1+BJsiZlY9HVjSWO6EUdLEit0HYw OliA== 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:mime-version :message-id:date:subject:cc:to:from; bh=BeoDgW7UI6JXoCaNjfvq9c8m9uLDDYgVEYUg+iUlyY8=; b=Srcov9H9bxtH4iMZ1eYreX3bYUv7hmbHW+0x/dy6zGLycL+7/l22wj06rrRXlibudd aV3XnzAKq1USycIHYBEGJeqfzHi7BbMak8gKuMVEF0xbyf1IKcPP3AXAQwhnc5hvI2To gdR/4yIPcx6SHuwiaR6Cuqse3cxzvXfJfLENgaNLRkan/GyjeA10psmORqQrOhKk76TM ac1NCAkrnh/poUsmJhy76dJsVirpbKfHSm0w7JvwK4ibiSdWlsHkvN+BLG1oYdW/mIYv VUOkTPTfym2yZEzCnROWkv4Iq++BPCk9eD1xgYNW/Sy+tqEqhaJlU6NIQIZ+O2np8LWr 0HKA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f17si2364073edr.515.2020.05.27.20.47.35; Wed, 27 May 2020 20:47:58 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727032AbgE1Dn6 (ORCPT + 99 others); Wed, 27 May 2020 23:43:58 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5358 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726530AbgE1Dn6 (ORCPT ); Wed, 27 May 2020 23:43:58 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 6424043087DF6C431BE4; Thu, 28 May 2020 11:43:57 +0800 (CST) Received: from huawei.com (10.175.104.175) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.487.0; Thu, 28 May 2020 11:43:46 +0800 From: liuchao To: , CC: , , , liuchao Subject: [RFC] decrease tsk->signal->live before profile_task_exit Date: Thu, 28 May 2020 12:09:56 +0800 Message-ID: <20200528040956.30155-1-liuchao173@huawei.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.175] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I want to dermine which thread is the last one to enter do_exit in profile_task_exit. But when a lot of threads exit, tsk->signal->live is not correct since it decrease after profile_task_exit. Signed-off-by: liuchao --- kernel/exit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/exit.c b/kernel/exit.c index ce2a75bc0ade..1693764bc356 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -708,6 +708,7 @@ void __noreturn do_exit(long code) struct task_struct *tsk = current; int group_dead; + group_dead = atomic_dec_and_test(&tsk->signal->live); profile_task_exit(tsk); kcov_task_exit(tsk); @@ -755,7 +756,6 @@ void __noreturn do_exit(long code) if (tsk->mm) sync_mm_rss(tsk->mm); acct_update_integrals(tsk); - group_dead = atomic_dec_and_test(&tsk->signal->live); if (group_dead) { /* * If the last thread of global init has exited, panic -- 2.19.1