Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751613AbdLTFTL (ORCPT ); Wed, 20 Dec 2017 00:19:11 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:46152 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751348AbdLTFTK (ORCPT ); Wed, 20 Dec 2017 00:19:10 -0500 Date: Tue, 19 Dec 2017 21:19:18 -0800 From: "Paul E. McKenney" To: Matthew Wilcox Cc: Jesper Dangaard Brouer , rao.shoaib@oracle.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] kfree_rcu() should use the new kfree_bulk() interface for freeing rcu structures Reply-To: paulmck@linux.vnet.ibm.com References: <1513705948-31072-1-git-send-email-rao.shoaib@oracle.com> <20171219214158.353032f0@redhat.com> <20171219221206.GA22696@bombadil.infradead.org> <20171220002051.GJ7829@linux.vnet.ibm.com> <20171220015336.GA7748@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171220015336.GA7748@bombadil.infradead.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17122005-0056-0000-0000-000003FBA93C X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008230; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000244; SDB=6.00962810; UDB=6.00487033; IPR=6.00742805; BA=6.00005752; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00018636; XFM=3.00000015; UTC=2017-12-20 05:19:08 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17122005-0057-0000-0000-00000832EEF9 Message-Id: <20171220051918.GK7829@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-20_02:,, 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712200076 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1536 Lines: 29 On Tue, Dec 19, 2017 at 05:53:36PM -0800, Matthew Wilcox wrote: > On Tue, Dec 19, 2017 at 04:20:51PM -0800, Paul E. McKenney wrote: > > If we are going to make this sort of change, we should do so in a way > > that allows the slab code to actually do the optimizations that might > > make this sort of thing worthwhile. After all, if the main goal was small > > code size, the best approach is to drop kfree_bulk() and get on with life > > in the usual fashion. > > > > I would prefer to believe that something like kfree_bulk() can help, > > and if that is the case, we should give it a chance to do things like > > group kfree_rcu() requests by destination slab and soforth, allowing > > batching optimizations that might provide more significant increases > > in performance. Furthermore, having this in slab opens the door to > > slab taking emergency action when memory is low. > > kfree_bulk does sort by destination slab; look at build_detached_freelist. Understood, but beside the point. I suspect that giving it larger scope makes it more efficient, similar to disk drives in the old days. Grouping on the stack when processing RCU callbacks limits what can reasonably be done. Furthermore, using the vector approach going into the grace period is much more cache-efficient than the linked-list approach, given that the blocks have a reasonable chance of going cache-cold during the grace period. And the slab-related operations should really be in the slab code in any case rather than within RCU. Thanx, Paul