linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHSET] idr: deprecate idr_remove_all()
@ 2013-01-26  1:30 Tejun Heo
  2013-01-26  1:30 ` [PATCH 01/14] idr: make idr_destroy() imply idr_remove_all() Tejun Heo
                   ` (13 more replies)
  0 siblings, 14 replies; 40+ messages in thread
From: Tejun Heo @ 2013-01-26  1:30 UTC (permalink / raw)
  To: akpm; +Cc: rusty, linux-kernel

Hello,

(Andrew, I think this one is best routed through -mm.  Please read on)

idr is one of the areas with much higher concentration of bad
interface and implementation decisions.  This patchset removes one of
those oddities - idr_remove_all().  idr needs two steps for
destruction - idr_remove_all() followed by idr_destroy().
idr_remove_all() releases all IDs in use but doesn't release buffered
idr_layers.  idr_destroy() frees buffered idr_layers() but doesn't
bother with in-use idr_layers.

For added fun, calling idr_remove() on all allocated IDs doesn't
necessarily free all in-use idr_layers, so idr_for_each_entry()
idr_remove(); followed by idr_destroy() may still leak memory.

This confuses people.  Some correctly use both.  Many forget to call
idr_remove_all() and others forget idr_destroy() and they all leak
memory.  Even ida - something tightly coupled w/ idr - forgets to do
idr_remove_all() (although it's my fault).

This is just a bad interface.  While remove_all in itself might not be
that bad, there is only one legitimate user of idr_remove_all() which
can be converted to idr_remove() relatively easily, so I think it'd be
better to deprecate and later unexport it than keeping it around.

This patchset contains the following 14 patches.

 0001-idr-make-idr_destroy-imply-idr_remove_all.patch
 0002-atm-nicstar-don-t-use-idr_remove_all.patch
 0003-block-loop-don-t-use-idr_remove_all.patch
 0004-firewire-don-t-use-idr_remove_all.patch
 0005-drm-don-t-use-idr_remove_all.patch
 0006-dm-don-t-use-idr_remove_all.patch
 0007-remoteproc-don-t-use-idr_remove_all.patch
 0008-rpmsg-don-t-use-idr_remove_all.patch
 0009-dlm-use-idr_for_each_entry-in-recover_idr_clear-erro.patch
 0010-dlm-don-t-use-idr_remove_all.patch
 0011-nfs-idr_destroy-no-longer-needs-idr_remove_all.patch
 0012-inotify-don-t-use-idr_remove_all.patch
 0013-cgroup-don-t-use-idr_remove_all.patch
 0014-idr-deprecate-idr_remove_all.patch

0001 makes idr_destroy() imply idr_remove_all().  0002-0013 remove
uses of idr_remove_all().  0014 marks idr_remove_all() deprecated.
The patches are on top of the current linus#master 66e2d3e8c2 and also
applies on top of the current -mm.  It's available in the following
git branch.

 git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc.git deprecate-idr_remove_all

As changes to most are trivial and have dependency on the first patch,
I think it would be best to route these together.  The only
non-trivial change is 0009 and 0010 which converts idr_for_each() to
idr_for_each_entry() and then replaces idr_remove_all() with
idr_remove() inside the for_each_entry loop.  Defintely wanna get acks
from dlm people.

Andrew, once people agree with the series, can you please route these
through -mm?

diffstat follows.  Thanks.

 drivers/atm/nicstar.c                   |    1 -
 drivers/block/loop.c                    |    1 -
 drivers/firewire/core-cdev.c            |    1 -
 drivers/gpu/drm/drm_context.c           |    2 +-
 drivers/gpu/drm/drm_crtc.c              |    1 -
 drivers/gpu/drm/drm_drv.c               |    1 -
 drivers/gpu/drm/drm_gem.c               |    2 --
 drivers/gpu/drm/exynos/exynos_drm_ipp.c |    4 ----
 drivers/gpu/drm/sis/sis_drv.c           |    1 -
 drivers/gpu/drm/via/via_map.c           |    1 -
 drivers/md/dm.c                         |    1 -
 drivers/remoteproc/remoteproc_core.c    |    1 -
 drivers/rpmsg/virtio_rpmsg_bus.c        |    1 -
 fs/dlm/lockspace.c                      |    1 -
 fs/dlm/recover.c                        |   25 +++++++++++--------------
 fs/nfs/client.c                         |    1 -
 fs/notify/inotify/inotify_fsnotify.c    |    1 -
 include/linux/idr.h                     |   14 +++++++++++++-
 kernel/cgroup.c                         |    4 +---
 lib/idr.c                               |   28 +++++++++++++---------------
 20 files changed, 39 insertions(+), 53 deletions(-)

--
tejun

^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2013-02-05 15:36 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-26  1:30 [PATCHSET] idr: deprecate idr_remove_all() Tejun Heo
2013-01-26  1:30 ` [PATCH 01/14] idr: make idr_destroy() imply idr_remove_all() Tejun Heo
2013-01-26  1:31 ` [PATCH 02/14] atm/nicstar: don't use idr_remove_all() Tejun Heo
2013-01-27  6:43   ` David Miller
2013-02-04 17:52   ` [PATCH v2 " Tejun Heo
2013-02-04 18:10     ` chas williams - CONTRACTOR
2013-02-04 18:35       ` Tejun Heo
2013-01-26  1:31 ` [PATCH 03/14] block/loop: " Tejun Heo
2013-01-26  1:31 ` [PATCH 04/14] firewire: " Tejun Heo
2013-01-26  9:07   ` Stefan Richter
2013-01-26  1:31 ` [PATCH 05/14] drm: " Tejun Heo
2013-01-26  1:31 ` [PATCH 06/14] dm: " Tejun Heo
2013-01-26  1:31 ` [PATCH 07/14] remoteproc: " Tejun Heo
2013-01-26  1:31 ` [PATCH 08/14] rpmsg: " Tejun Heo
2013-01-26  1:31 ` [PATCH 09/14] dlm: use idr_for_each_entry() in recover_idr_clear() error path Tejun Heo
2013-01-28 15:55   ` David Teigland
2013-01-26  1:31 ` [PATCH 10/14] dlm: don't use idr_remove_all() Tejun Heo
2013-01-28 15:57   ` David Teigland
2013-01-29 15:13     ` David Teigland
2013-01-30 21:24       ` David Teigland
2013-01-31 23:53         ` Tejun Heo
2013-02-01  0:18           ` Tejun Heo
2013-02-01 17:44             ` David Teigland
2013-02-01 18:00               ` Tejun Heo
2013-02-02 23:10                 ` [PATCH] idr: fix a subtle bug in idr_get_next() Tejun Heo
2013-02-02 23:11                   ` Tejun Heo
2013-02-03  2:15                     ` Randy Dunlap
2013-02-03 17:53                       ` Hugh Dickins
2013-02-05 15:36                     ` David Teigland
2013-02-04  3:39                   ` Li Zefan
2013-02-04 17:44                     ` Tejun Heo
2013-01-26  1:31 ` [PATCH 11/14] nfs: idr_destroy() no longer needs idr_remove_all() Tejun Heo
2013-01-29 22:58   ` J. Bruce Fields
2013-01-30  2:18     ` Myklebust, Trond
2013-02-01  0:08       ` Tejun Heo
2013-01-26  1:31 ` [PATCH 12/14] inotify: don't use idr_remove_all() Tejun Heo
2013-01-26  1:31 ` [PATCH 13/14] cgroup: " Tejun Heo
2013-01-26  1:31 ` [PATCH 14/14] idr: deprecate idr_remove_all() Tejun Heo
2013-01-26 13:48   ` Arnd Bergmann
2013-01-26 14:24     ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).