Received: by 10.213.65.68 with SMTP id h4csp417398imn; Wed, 4 Apr 2018 00:20:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/GTxcFtfN9Xd1s+IumduDhXM8nMyXLVLGhjQZ3vomLpWeQrcSdHTPrtFXMiE37Z4U9l4Ao X-Received: by 10.101.68.201 with SMTP id g9mr11307106pgs.263.1522826403994; Wed, 04 Apr 2018 00:20:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522826403; cv=none; d=google.com; s=arc-20160816; b=NENyLvj5kFR0Z4Vj9nvgwfHaM76jDuLvny54JBQuQ/Dg9CTMI44dyMhmkmcPF8H4oT qacQ3RVYgCyqnzPUtco3nO2pzqcMfqMENGyqeqLenTSK/zyZNZT3/BppQL44W1TTtqZJ OjQUlO7DO2b9PjLvgRNI9VOf8lHbT3dlFmpQvUs42m6xHe1Hkk26ToQlTAVscjBXgy5d QLDbZLXUtsiM22sey1HMyoSxWEhvLd96Wql5GzwLKi6lDh2X93XfjaYzpAnksifI4Cjb pgYGMSODdFHFcCXTam/cIGEEiCT7dhrdt74u0yt0KNxxIaLxLg04QRM19tZ4FR8VaBz0 hSrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=8ZY3Vx5Azs0AzQV6iQ7lMYwEoU37YWrFTL6xL33eLi4=; b=BkVVRySFChxErhruM0m6taePWIQ/yffAqzkLEp4pa7UfxoDzdJEW3A6iBvVSEXzR2S /pEkGXPNVwl2PbN61vA7mBIUfSWL/20VDpMyBq52Phf6SsK9rySBZQPG0+PjeIcgPnly /hMaLkic13vPzhq/EF+ciw7mUjrvr57eMR81kBmkZqJ70ExsNRNvL5W5BA7w0CmHiyZ/ Ro/mLfeNwOT/Jym8aozu7Wc+x0oNHxPKvskStC3g/6TuWptXPuJxVFuaDkPWeiojMXXg ujThBLnLBZ0GyHnr3RYV87Kxui9y0WW5zWYdUg+bJue07c+b6VtYIYGG6Bwj5qbO99Uo lKhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=SNFvZaGq; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si2519463plj.275.2018.04.04.00.19.50; Wed, 04 Apr 2018 00:20:03 -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; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=SNFvZaGq; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751555AbeDDHSR (ORCPT + 99 others); Wed, 4 Apr 2018 03:18:17 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:52738 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751470AbeDDHSP (ORCPT ); Wed, 4 Apr 2018 03:18:15 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w347Gl7Q153359; Wed, 4 Apr 2018 07:17:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=8ZY3Vx5Azs0AzQV6iQ7lMYwEoU37YWrFTL6xL33eLi4=; b=SNFvZaGqJOCHmM7SGbyeAHRyxMUpdIj8jUMHkvw+2/mITzZ/635CCC1Dg/eqU5iNGpyr OcJFgwHpr6JEMJaFDSTsi8ABqKZQLvICefA5NLc4dqd1xz1THnMSKu2vkm8xVX2Wl2yb G6k2z+cY40umlhbOhcrL9ygVkuGJo58XYTH42FKaYFimSDb48Lc/Xctha9bs+zuPcQ0G Yh93+epWg5WfWozeyn8uRHOI/b3+wXC2H+FA1ztzdrrJZM09QDjy6excFycTZrY0ICto QsrroCS+pO6Y3n/sjTUl6IGbvczBUntrg3ZUp0E8p6c50rZXYTMfSpSzminQq5l3/6xz ng== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2h4t67g2ag-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 Apr 2018 07:17:48 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w347G9CW013802 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 4 Apr 2018 07:16:09 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w347G8Kf030757; Wed, 4 Apr 2018 07:16:08 GMT Received: from [192.168.1.34] (/67.188.214.158) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 04 Apr 2018 00:16:07 -0700 Subject: Re: [PATCH 2/2] kfree_rcu() should use kfree_bulk() interface To: Matthew Wilcox Cc: linux-kernel@vger.kernel.org, paulmck@linux.vnet.ibm.com, joe@perches.com, brouer@redhat.com, linux-mm@kvack.org References: <1522776173-7190-1-git-send-email-rao.shoaib@oracle.com> <1522776173-7190-3-git-send-email-rao.shoaib@oracle.com> <20180403205822.GB30145@bombadil.infradead.org> <20180404022347.GA17512@bombadil.infradead.org> From: Rao Shoaib Message-ID: <954a9ea2-5202-4ee3-1fa2-21acf8d07cdb@oracle.com> Date: Wed, 4 Apr 2018 00:16:06 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180404022347.GA17512@bombadil.infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8852 signatures=668697 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1804040075 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/03/2018 07:23 PM, Matthew Wilcox wrote: > On Tue, Apr 03, 2018 at 05:55:55PM -0700, Rao Shoaib wrote: >> On 04/03/2018 01:58 PM, Matthew Wilcox wrote: >>> I think you might be better off with an IDR. The IDR can always >>> contain one entry, so there's no need for this 'rbf_list_head' or >>> __rcu_bulk_schedule_list. The IDR contains its first 64 entries in >>> an array (if that array can be allocated), so it's compatible with the >>> kfree_bulk() interface. >>> >> I have just familiarized myself with what IDR is by reading your article. If >> I am incorrect please correct me. >> >> The list and head you have pointed are only used  if the container can not >> be allocated. That could happen with IDR as well. Note that the containers >> are allocated at boot time and are re-used. > No, it can't happen with the IDR. The IDR can always contain one entry > without allocating anything. If you fail to allocate the second entry, > just free the first entry. > >> IDR seems to have some overhead, such as I have to specifically add the >> pointer and free the ID, plus radix tree maintenance. > ... what? Adding a pointer is simply idr_alloc(), and you get back an > integer telling you which index it has. Your data structure has its > own set of overhead. The only overhead is a pointer that points to the head and an int to keep count. If I use idr, I would have to allocate an struct idr which is much larger. idr_alloc()/idr_destroy() operations are much more costly than updating two pointers. As the pointers are stored in slots/nodes corresponding to the id, I would  have to retrieve the pointers by calling idr_remove() to pass them to be freed, the slots/nodes would constantly be allocated and freed. IDR is a very useful interface for allocating/managing ID's but I really do not see the justification for using it over here, perhaps you can elaborate more on the benefits and also on how I can just pass the array to be freed. Shoaib