lkml.org 
[lkml]   [2016]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [RFC 00/10] implement alternative and much simpler id allocator
Date
From: Tejun Heo [mailto:htejun@gmail.com] On Behalf Of Tejun Heo
> Ah, yeah, great to see the silly implementation being replaced the
> radix tree. ida_pre_get() looks suspicious tho. idr_preload()
> immedicately being followed by idr_preload_end() probably is broken.
> Maybe what we need is moving ida to idr like preload interface and
> then convert it to radix based interface? ida currently assumes
> per-ida preloading.

Hey Tejun! Great to have your comments on this reimplementation.

I know the preload followed by preload_end looks wrong. I don't think it's broken though. If we get preempted, then the worst situation is that we'll end up with the memory we preallocated being allocated to somebody else. Then the attempt to allocate memory can fail, and we'll return -EAGAIN, at which point all callers are supposed to return to the pre_get() stage. Certainly that's what ida_simple_get() does.

Hmm ... looking at the implementation again, we might return -ENOMEM when we should return -EAGAIN. Let me fix that (and the test suite ...)

I'd definitely be open to changing the IDA API. I know Kent had some thoughts on that including splitting the simple lock into a per-IDA lock. His last work on it was here, I believe:

https://evilpiepirate.org/git/linux-bcache.git/log/?h=idr

\
 
 \ /
  Last update: 2016-12-12 18:35    [W:0.114 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site