From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757390AbbCDAVL (ORCPT ); Tue, 3 Mar 2015 19:21:11 -0500 Received: from mail-pa0-f52.google.com ([209.85.220.52]:34725 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755172AbbCDAVJ (ORCPT ); Tue, 3 Mar 2015 19:21:09 -0500 Date: Wed, 4 Mar 2015 09:21:12 +0900 From: Sergey Senozhatsky To: Andrew Morton Cc: Sergey Senozhatsky , Minchan Kim , Nitin Gupta , linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCH 2/8] zram: use idr instead of `zram_devices' array Message-ID: <20150304002112.GB1864@swordfish> References: <1425386990-6339-1-git-send-email-sergey.senozhatsky@gmail.com> <1425386990-6339-3-git-send-email-sergey.senozhatsky@gmail.com> <20150303140141.9adbb3dae4253130aad5d16b@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150303140141.9adbb3dae4253130aad5d16b@linux-foundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (03/03/15 14:01), Andrew Morton wrote: > > This patch makes some preparations for dynamic device ADD/REMOVE functionality > > via /dev/zram-control interface. > > > > Remove `zram_devices' array and switch to id-to-pointer translation (idr). > > idr doesn't bloat zram struct with additional members, f.e. list_head, yet > > still provides ability to match the device_id with the device pointer. > > No user-space visible changes. > > > > ... > > > > +static DEFINE_IDR(zram_index_idr); > > There is no locking protecting this idr? > correct. there is no concurrent idr index modification at this point. add/remove functionality and concurrent idr modification will be intoriduced in the patch 0005 zram add dynamic device add remove functionality (along with `static DEFINE_MUTEX(zram_index_mutex)' idr protection). -ss