Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1892234ybn; Thu, 26 Sep 2019 03:54:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqyKFjdj+eHsaytPXyspBolYaB3Uc2H5xHXMOBEavJ2O4AbdmJwMyVnH2SmZ/RMbB4CWfBoJ X-Received: by 2002:a50:dac2:: with SMTP id s2mr2856532edj.26.1569495279513; Thu, 26 Sep 2019 03:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569495279; cv=none; d=google.com; s=arc-20160816; b=Ob62KGRFOkpCNfF01eaHiWJ6+DlIT1HwPcqFqX01kTlqQa9KPFdevOR/D7H+5gzhzj yTefExwqE12KMq0Y3aR9Ic435EXxe/EjlhMn8L2xqEXMJVnqlduV7Qzkda6SsfOsNgyd os4ME0xOqXWmQ13EAHtTzoL2t3YJaWH5OzyIKgz/i2/WwEZtOMThW2mZo2+KF1CuQRyn 3LPNWSY6Up96nxBnAOee0jGxSri89exUQclU6MP++G5UkgjPjiLpjaOrBCYV7jsnWS+H lqab0p/10774w0reKvudIY9ONO+T9+bVQaJxOhNJIC9KSWsy8N9SL8i1L0/+u+DxiXHl 1wDg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=PY0aovy2hZax73fvYVLFBXnhrmQIklHtIC+MvNnLLZY=; b=PaKwSRfJ2+Th4aDDOzdnBUFtE+cf4XsepG4q36GhzUofuR3G06HPbJVPtZDSuSXM5s 5kfqZLgP3rM6g4/eWKirL4T2rMPw8zxaXK0sTDxl2xwf6CTZr71GtWWmEIyRJeIivDf6 qoshKVtpp+cbuPne6iCb9UJIVw9Mqp1llxk84Z1788lEeR0uMWB3Cfmc9Q0fNLqXCkq0 BWuBqTYwBKi2eIItYH0LV/knDU3Wxgt//ZnEs6Wy9vVNFS3t62UAAAPUxeI/iUM6u1xU TdboRQW/8ja4BBsUaPcwMrlRGICXmoWkw+ZhthFnAZOStDgqVm33qElK1B6J/nDkb5VI PN4A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h15si1073884eda.284.2019.09.26.03.54.16; Thu, 26 Sep 2019 03:54:39 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406947AbfIYNqb (ORCPT + 99 others); Wed, 25 Sep 2019 09:46:31 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:2721 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2406887AbfIYNqa (ORCPT ); Wed, 25 Sep 2019 09:46:30 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 837F7C084E2234E37D0C; Wed, 25 Sep 2019 21:46:26 +0800 (CST) Received: from [127.0.0.1] (10.177.251.225) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Wed, 25 Sep 2019 21:46:25 +0800 Subject: Re: [PATCH] async: Let kfree() out of the critical area of the lock To: "gregkh@linuxfoundation.org" CC: , , , "tglx@linutronix.de" , , , "linux-kernel@vger.kernel.org" References: <216356b1-38c1-8477-c4e8-03f497dd6ac8@huawei.com> <20190925133826.GA1496885@kroah.com> From: Yunfeng Ye Message-ID: Date: Wed, 25 Sep 2019 21:45:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190925133826.GA1496885@kroah.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.251.225] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/9/25 21:38, gregkh@linuxfoundation.org wrote: > On Wed, Sep 25, 2019 at 08:52:26PM +0800, Yunfeng Ye wrote: >> It's not necessary to put kfree() in the critical area of the lock, so >> let it out. >> >> Signed-off-by: Yunfeng Ye >> --- >> kernel/async.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/kernel/async.c b/kernel/async.c >> index 4f9c1d6..1de270d 100644 >> --- a/kernel/async.c >> +++ b/kernel/async.c >> @@ -135,12 +135,12 @@ static void async_run_entry_fn(struct work_struct *work) >> list_del_init(&entry->domain_list); >> list_del_init(&entry->global_list); >> >> - /* 3) free the entry */ >> - kfree(entry); >> atomic_dec(&entry_count); >> - >> spin_unlock_irqrestore(&async_lock, flags); >> >> + /* 3) free the entry */ >> + kfree(entry); >> + >> /* 4) wake up any waiters */ >> wake_up(&async_done); >> } >> -- >> 2.7.4 >> > > Does this result any any measurable performance changes? > No performance has been Measured at present, I just want the critical area to be as short as possible. I think it's good to put it outside. thanks > thanks, > > greg k-h > > . >