From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk0-f198.google.com (mail-qk0-f198.google.com [209.85.220.198]) by kanga.kvack.org (Postfix) with ESMTP id 06BBE6B0038 for ; Tue, 19 Dec 2017 15:22:27 -0500 (EST) Received: by mail-qk0-f198.google.com with SMTP id d9so452611qkg.13 for ; Tue, 19 Dec 2017 12:22:27 -0800 (PST) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com. [148.163.158.5]) by mx.google.com with ESMTPS id i190si182159qkf.377.2017.12.19.12.22.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Dec 2017 12:22:25 -0800 (PST) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vBJKDwWa112790 for ; Tue, 19 Dec 2017 15:22:25 -0500 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ey4cksju0-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 19 Dec 2017 15:22:25 -0500 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 19 Dec 2017 15:22:24 -0500 Date: Tue, 19 Dec 2017 12:22:32 -0800 From: "Paul E. McKenney" 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> <20171219193039.GB6515@bombadil.infradead.org> <24c9f1c0-58d4-5d27-8795-d211693455dd@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <24c9f1c0-58d4-5d27-8795-d211693455dd@oracle.com> Message-Id: <20171219202232.GE7829@linux.vnet.ibm.com> Sender: owner-linux-mm@kvack.org List-ID: To: Rao Shoaib Cc: Matthew Wilcox , linux-kernel@vger.kernel.org, brouer@redhat.com, linux-mm@kvack.org On Tue, Dec 19, 2017 at 11:56:30AM -0800, Rao Shoaib wrote: > On 12/19/2017 11:30 AM, Matthew Wilcox wrote: > >On Tue, Dec 19, 2017 at 09:52:27AM -0800, rao.shoaib@oracle.com wrote: [ . . . ] > >I've been doing a lot of thinking about this because I really want a > >way to kfree_rcu() an object without embedding a struct rcu_head in it. > >But I see no way to do that today; even if we have an external memory > >allocation to point to the object to be freed, we have to keep track of > >the grace periods. > I am not sure I understand. If you had external memory you can > easily do that. > I am exactly doing that, the only reason the RCU structure is needed > is to get the pointer to the object being freed. This can be done as long as you are willing to either: 1. Occasionally have kfree_rcu() wait for a grace period. 2. Occasionally have kfree_rcu() allocate memory. 3. Keep the rcu_head, but use it only when you would otherwise have to accept the above two penalties. (The point of this is that tracking lists of memory waiting for a grace period using dense arrays improves cache locality.) There might be others, and if you come up with one, please don't keep it a secret. The C++ standards committee insisted on an interface using option #2 above. (There is also an option to use their equivalent of an rcu_head.) Thanx, Paul -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753156AbdLSUW2 (ORCPT ); Tue, 19 Dec 2017 15:22:28 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51102 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752023AbdLSUW0 (ORCPT ); Tue, 19 Dec 2017 15:22:26 -0500 Date: Tue, 19 Dec 2017 12:22:32 -0800 From: "Paul E. McKenney" To: Rao Shoaib Cc: Matthew Wilcox , linux-kernel@vger.kernel.org, brouer@redhat.com, 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> <20171219193039.GB6515@bombadil.infradead.org> <24c9f1c0-58d4-5d27-8795-d211693455dd@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <24c9f1c0-58d4-5d27-8795-d211693455dd@oracle.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17121920-2213-0000-0000-0000024D61A2 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008228; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000244; SDB=6.00962632; UDB=6.00486926; IPR=6.00742626; 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.00018629; XFM=3.00000015; UTC=2017-12-19 20:22:23 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17121920-2214-0000-0000-0000587DC933 Message-Id: <20171219202232.GE7829@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-19_11:,, 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-1712190288 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 19, 2017 at 11:56:30AM -0800, Rao Shoaib wrote: > On 12/19/2017 11:30 AM, Matthew Wilcox wrote: > >On Tue, Dec 19, 2017 at 09:52:27AM -0800, rao.shoaib@oracle.com wrote: [ . . . ] > >I've been doing a lot of thinking about this because I really want a > >way to kfree_rcu() an object without embedding a struct rcu_head in it. > >But I see no way to do that today; even if we have an external memory > >allocation to point to the object to be freed, we have to keep track of > >the grace periods. > I am not sure I understand. If you had external memory you can > easily do that. > I am exactly doing that, the only reason the RCU structure is needed > is to get the pointer to the object being freed. This can be done as long as you are willing to either: 1. Occasionally have kfree_rcu() wait for a grace period. 2. Occasionally have kfree_rcu() allocate memory. 3. Keep the rcu_head, but use it only when you would otherwise have to accept the above two penalties. (The point of this is that tracking lists of memory waiting for a grace period using dense arrays improves cache locality.) There might be others, and if you come up with one, please don't keep it a secret. The C++ standards committee insisted on an interface using option #2 above. (There is also an option to use their equivalent of an rcu_head.) Thanx, Paul