Received: by 10.213.65.68 with SMTP id h4csp3962391imn; Tue, 3 Apr 2018 13:59:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx49+RCEqpPxxJUO25VicaU2HI+fBzRejrJQ+ajCGZePd9JUMPzXNOkmv2ExKgN6spx4Vps9S X-Received: by 2002:a17:902:206:: with SMTP id 6-v6mr15679909plc.376.1522789188732; Tue, 03 Apr 2018 13:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522789188; cv=none; d=google.com; s=arc-20160816; b=xrawSCImdjftAvSUamnMmk0BR+liX37PTOOZ9ZyCm21HyWxVnDS5b+WLPp+CghwxMM +6fwYLqvrBEQIfW05//TvBmyyPx4XtszfrhFwR8z7sNVfEV0y2ru6mADQRiQlN7RL7x1 cfz4RY3wuI5G8A8e+1Ze+oo7ze0TCXqIfGcQ/lVPLF9xY4Zt++81wVyxZsdYTDi9Ojqu wYzrfWeFL9bQAfLnoB1oMlMlJ/MiHAz6mBppvWJ+Pxmtz5sDyIhXZpNGC7E3GgDaLUbx JWEBTahpFC/oHu3bGiwdfo/5zKWL6JHfwf0ho7F5oH3S+5B5+ctsqTD7WfrQHt8sRW1u HGzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=RPrJcXs7QO0Xzb+GjVUwe4Ee42Psy+uRlyryR4l1X84=; b=ESX9Upjui3VYYR2rAvHe+eWHr5QWZkoyD3eIQs3UpsG6zYa9p99uujM/1rhy3Xu/dp BYPUgWpplMxxoV1XSGJI45XwADT3jESai2x9P6PxEL0DRiJNc0eovLyF9gdSmUFUYM2T WeHanR0heendXheTkNRemCSe/v+XBbRy2zRAS5bVlL9TvdIa6eelZNmY1ICWua+2K4hH MS9Ka3eB+YRsIyI2S0rmlevJdGC/gydrPpGhSgXam8cGlo3mSs05i++prTsaLPA1OLPD WCfcnNmQPeMmHo0tmK4hNI763z5zVj6HootTmlQtpl64yR9t4EoFo/SO0NSdQ+M4EGqE KvdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qtFNDXMA; 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 v2si2561199pgo.639.2018.04.03.13.59.34; Tue, 03 Apr 2018 13:59:48 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qtFNDXMA; 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 S1753367AbeDCU6X (ORCPT + 99 others); Tue, 3 Apr 2018 16:58:23 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:40808 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753308AbeDCU6X (ORCPT ); Tue, 3 Apr 2018 16:58:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=RPrJcXs7QO0Xzb+GjVUwe4Ee42Psy+uRlyryR4l1X84=; b=qtFNDXMAfJd+8WUufQ+iXvAIb U2uQMnNmfKN8IDQIBlYwuXH6ASB0d3cyIzexT8Ld0sBfsUAyt22bh/UyU0xaNa0W2/u9gIBHYThp2 /diiOWPf/LCEVkuH5IRZ1CtBAp4Yl8Cn+5CY53dJTx5fndQdi0jZOfURewc53XLkis9jdhNwJ48vx bt62qU6wqyepsxNtZB99uiaQqZXxGLfxOl4jOSmjVsKp5Fm+kjLFeC2h4TV1KbKa4FvYsWxK8W7DI y1akK2Nb6goUwXCcBeatqLpE4KHowKv1ZuugG9l12D4E+QteU5aVcZtEcF1X8asko+9ZkIzBiJ8AZ EvOi/rkhA==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1f3T0Y-00007E-CR; Tue, 03 Apr 2018 20:58:22 +0000 Date: Tue, 3 Apr 2018 13:58:22 -0700 From: Matthew Wilcox To: rao.shoaib@oracle.com Cc: linux-kernel@vger.kernel.org, paulmck@linux.vnet.ibm.com, joe@perches.com, brouer@redhat.com, linux-mm@kvack.org Subject: Re: [PATCH 2/2] kfree_rcu() should use kfree_bulk() interface Message-ID: <20180403205822.GB30145@bombadil.infradead.org> References: <1522776173-7190-1-git-send-email-rao.shoaib@oracle.com> <1522776173-7190-3-git-send-email-rao.shoaib@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1522776173-7190-3-git-send-email-rao.shoaib@oracle.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 03, 2018 at 10:22:53AM -0700, rao.shoaib@oracle.com wrote: > +++ b/mm/slab.h > @@ -80,6 +80,29 @@ extern const struct kmalloc_info_struct { > unsigned long size; > } kmalloc_info[]; > > +#define RCU_MAX_ACCUMULATE_SIZE 25 > + > +struct rcu_bulk_free_container { > + struct rcu_head rbfc_rcu; > + int rbfc_entries; > + void *rbfc_data[RCU_MAX_ACCUMULATE_SIZE]; > + struct rcu_bulk_free *rbfc_rbf; > +}; > + > +struct rcu_bulk_free { > + struct rcu_head rbf_rcu; /* used to schedule monitor process */ > + spinlock_t rbf_lock; > + struct rcu_bulk_free_container *rbf_container; > + struct rcu_bulk_free_container *rbf_cached_container; > + struct rcu_head *rbf_list_head; > + int rbf_list_size; > + int rbf_cpu; > + int rbf_empty; > + int rbf_polled; > + bool rbf_init; > + bool rbf_monitor; > +}; 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.