From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vivek Goyal Subject: Re: [PATCH 1/8] blkcg: kill blkio_list and replace blkio_list_lock with a mutex Date: Fri, 13 Apr 2012 09:32:26 -0400 Message-ID: <20120413133226.GB26383@redhat.com> References: <1334273380-30233-1-git-send-email-tj@kernel.org> <1334273380-30233-2-git-send-email-tj@kernel.org> Mime-Version: 1.0 Return-path: Content-Disposition: inline In-Reply-To: <1334273380-30233-2-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Tejun Heo Cc: axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org, ctalbott-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, rni-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org On Thu, Apr 12, 2012 at 04:29:33PM -0700, Tejun Heo wrote: Hi Tejun, > @@ -732,20 +732,21 @@ void blkio_policy_register(struct blkio_policy_type *blkiop) > { > struct request_queue *q; > > + mutex_lock(&blkcg_pol_mutex); > + > blkcg_bypass_start(); > - spin_lock(&blkio_list_lock); > > BUG_ON(blkio_policy[blkiop->plid]); A minor nit. It might be a good idea to check that blkiop->plid is not greater than BLKIO_NR_POLICIES for both registration and unresitration functions to avoid touching memory beyond blkio_policy[] array. Thanks Vivek From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756770Ab2DMNcf (ORCPT ); Fri, 13 Apr 2012 09:32:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2308 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751473Ab2DMNcd (ORCPT ); Fri, 13 Apr 2012 09:32:33 -0400 Date: Fri, 13 Apr 2012 09:32:26 -0400 From: Vivek Goyal To: Tejun Heo Cc: axboe@kernel.dk, ctalbott@google.com, rni@google.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, containers@lists.linux-foundation.org Subject: Re: [PATCH 1/8] blkcg: kill blkio_list and replace blkio_list_lock with a mutex Message-ID: <20120413133226.GB26383@redhat.com> References: <1334273380-30233-1-git-send-email-tj@kernel.org> <1334273380-30233-2-git-send-email-tj@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1334273380-30233-2-git-send-email-tj@kernel.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 12, 2012 at 04:29:33PM -0700, Tejun Heo wrote: Hi Tejun, > @@ -732,20 +732,21 @@ void blkio_policy_register(struct blkio_policy_type *blkiop) > { > struct request_queue *q; > > + mutex_lock(&blkcg_pol_mutex); > + > blkcg_bypass_start(); > - spin_lock(&blkio_list_lock); > > BUG_ON(blkio_policy[blkiop->plid]); A minor nit. It might be a good idea to check that blkiop->plid is not greater than BLKIO_NR_POLICIES for both registration and unresitration functions to avoid touching memory beyond blkio_policy[] array. Thanks Vivek