Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp7169862ybh; Thu, 8 Aug 2019 11:12:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJl5fDi1ir89ny11kQ+G2G98O7G6EDAfA+sVSwpdgOFazCjnFLwjWdHqV7Tw67thdIrWqs X-Received: by 2002:a17:90a:f491:: with SMTP id bx17mr5472182pjb.118.1565287961113; Thu, 08 Aug 2019 11:12:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565287961; cv=none; d=google.com; s=arc-20160816; b=wKWE2cHEX3Kd/5kEnzDaKQc8x3sTXUQhwUHKNd17vsef6FqtyIczzjChjawbbmaU+r W4BFoklPEsBVt605oypmkfuuKjQRoscfsdBwabioWnYdcGks+5W/V9XKU+40v18/E7tL CeflqoyQOrbV1GWZCcYCY/P8sd8u6NwXhG35M8W4KwdK9tT1MaXKGJkhVLmjrgSOd4Tj n13GrEDgdp/TjBGVq969VGrkhhLR2rFLKlAu77sAR0xemyVgVDvisn7SLwXnAUczRRPa PBx1KQZ5vcsWpBcIPZEQGfp6waJ/c6q77R94cJ1QBxTpZKfmZxj4+DR6qL08uGLJmMle Capg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date; bh=SWTn+ShdkGeIz/RdZ1LaEx3C2GZ9nGHqgKRr8kIsVxs=; b=BIHjY0nMlmgI/66cv3gpPpMzcnRl9LMd7BitjyH8lC0tNdDS4R3Q8B0bPAcz6b80Ns FrtsHkVBz8SMGqP4iUr1MuIR1Ifx972jPt7G1NY16n46+TMWjHPk29e17+6+wvUD4yHn oxx+w2QzIVOXSOuT766rFycWfBo5yYYEsoU27/FnyZ+pYB4AqDDcvnWG54q9WPjZcvV0 sVWSITFsAAf3jkPUK3mVEmOmkrm7CObF/zj+4lQZwbl4PAAl0IvxJoEvk9jUBQ6vgWLF S3sW+ERnS+4v8MDoqKLTodRpS83BAqfTNfgssKJTrJG2FshTg0OAVVQj8elUqucVbuYR NnDQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b11si46338025plz.307.2019.08.08.11.12.25; Thu, 08 Aug 2019 11:12:41 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390137AbfHHSLT (ORCPT + 99 others); Thu, 8 Aug 2019 14:11:19 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:62210 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725785AbfHHSLT (ORCPT ); Thu, 8 Aug 2019 14:11:19 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x78I7cWY127018 for ; Thu, 8 Aug 2019 14:11:18 -0400 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0a-001b2d01.pphosted.com with ESMTP id 2u8pg5duhm-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 08 Aug 2019 14:11:17 -0400 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Aug 2019 19:11:16 +0100 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 8 Aug 2019 19:11:12 +0100 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x78IBB3x13697810 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 Aug 2019 18:11:11 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8F45FB206C; Thu, 8 Aug 2019 18:11:11 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7A03EB2068; Thu, 8 Aug 2019 18:11:11 +0000 (GMT) Received: from paulmck-ThinkPad-W541 (unknown [9.70.82.154]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 8 Aug 2019 18:11:11 +0000 (GMT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id AF7AF16C8EB1; Thu, 8 Aug 2019 11:11:12 -0700 (PDT) Date: Thu, 8 Aug 2019 11:11:12 -0700 From: "Paul E. McKenney" To: Byungchul Park Cc: Joel Fernandes , linux-kernel@vger.kernel.org, Rao Shoaib , max.byungchul.park@gmail.com, kernel-team@android.com, kernel-team@lge.com, Davidlohr Bueso , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , rcu@vger.kernel.org, Steven Rostedt Subject: Re: [PATCH RFC v1 1/2] rcu/tree: Add basic support for kfree_rcu batching Reply-To: paulmck@linux.ibm.com References: <20190806212041.118146-1-joel@joelfernandes.org> <20190806235631.GU28441@linux.ibm.com> <20190807094504.GB169551@google.com> <20190808102610.GA7227@X58A-UD3R> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190808102610.GA7227@X58A-UD3R> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 19080818-0064-0000-0000-00000406E49F X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011571; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000287; SDB=6.01243948; UDB=6.00656251; IPR=6.01025426; MB=3.00028095; MTD=3.00000008; XFM=3.00000015; UTC=2019-08-08 18:11:16 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19080818-0065-0000-0000-00003E98BA38 Message-Id: <20190808181112.GQ28441@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-08-08_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908080162 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 08, 2019 at 07:26:10PM +0900, Byungchul Park wrote: > On Wed, Aug 07, 2019 at 05:45:04AM -0400, Joel Fernandes wrote: > > On Tue, Aug 06, 2019 at 04:56:31PM -0700, Paul E. McKenney wrote: > > [snip] > > > > On Tue, Aug 06, 2019 at 05:20:40PM -0400, Joel Fernandes (Google) wrote: > > > Of course, I am hoping that a later patch uses an array of pointers built > > > at kfree_rcu() time, similar to Rao's patch (with or without kfree_bulk) > > > in order to reduce per-object cache-miss overhead. This would make it > > > easier for callback invocation to keep up with multi-CPU kfree_rcu() > > > floods. > > > > I think Byungchul tried an experiment with array of pointers and wasn't > > immediately able to see a benefit. Perhaps his patch needs a bit more polish > > or another test-case needed to show benefit due to cache-misses, and the perf > > tool could be used to show if cache misses were reduced. For this initial > > pass, we decided to keep it without the array optimization. > > I'm still seeing no improvement with kfree_bulk(). > > I've been thinking I could see improvement with kfree_bulk() because: > > 1. As you guys said, the number of cache misses will be reduced. > 2. We can save (N - 1) irq-disable instructions while N kfrees. > 3. As Joel said, saving/restoring CPU status that kfree() does inside > is not required. > > But even with the following patch applied, the result was same as just > batching test. We might need to get kmalloc objects from random > addresses to maximize the result when using kfree_bulk() and this is > even closer to real practical world too. > > And the second and third reasons doesn't seem to work as much as I > expected. > > Do you have any idea? Or what do you think about it? I would not expect kfree_batch() to help all that much unless the pre-grace-period kfree_rcu() code segregated the objects on a per-slab basis. Thanx, Paul > Thanks, > Byungchul > > -----8<----- > diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c > index 988e1ae..6f2ab06 100644 > --- a/kernel/rcu/rcuperf.c > +++ b/kernel/rcu/rcuperf.c > @@ -651,10 +651,10 @@ struct kfree_obj { > return -ENOMEM; > } > > - for (i = 0; i < kfree_alloc_num; i++) { > - if (!kfree_no_batch) { > - kfree_rcu(alloc_ptrs[i], rh); > - } else { > + if (!kfree_no_batch) { > + kfree_bulk(kfree_alloc_num, (void **)alloc_ptrs); > + } else { > + for (i = 0; i < kfree_alloc_num; i++) { > rcu_callback_t cb; > > cb = (rcu_callback_t)(unsigned long)offsetof(struct kfree_obj, rh); >