LWN: Comments on "A simplified IDR API"
http://lwn.net/Articles/536293/
This is a special feed containing comments posted
to the individual LWN article titled "A simplified IDR API".
hourly2A simplified IDR API
http://lwn.net/Articles/537100/rss
2013-02-09T15:42:49+00:00dmk
<div class="FormattedComment">
If you need to pair some calls, and the second one has an _end() suffix, <br>
you damn well need the _begin() suffix on the first one.<br>
<p>
Everything else is confusing.<br>
</div>
A simplified IDR API
http://lwn.net/Articles/536749/rss
2013-02-07T14:55:40+00:00corbet
Not stupid. The relevant code is (usually) about to go under spinlock anyway, so the preemption disable isn't as big a deal as it could be. An API like you suggest could maybe work; one could also maybe split it into:
<p>
<pre>
id = idr_allocate_id(gfp_flags); /* non-atomic context */
idr_assign_id(id, pointer); /* Can be atomic */
</pre>
<p>
That would handle the atomic association of the ID with the pointer while under lock without per-CPU stuff, but would require the IDR library to manage assigned-but-not-active IDs. With either this idea or yours, there would also have to be an <tt>idr_never_mind()</tt> function to back things out if need be.
A simplified IDR API
http://lwn.net/Articles/536743/rss
2013-02-07T14:49:50+00:00amonnet
<div class="FormattedComment">
Second (stupid?) question : why not provide the second call a reference to the allocated memory from the first one ? And forget the preemption deactivation dance that some (RT people) dislike ?<br>
</div>
A simplified IDR API
http://lwn.net/Articles/536741/rss
2013-02-07T14:21:47+00:00corbet
IDR has to allocate memory <i>for IDR's internal record keeping</i>; there is a radix-tree like structure for fast lookups and traversal. The caller doesn't (and shouldn't) know about that structure, so it cannot allocate it.
A simplified IDR API
http://lwn.net/Articles/536677/rss
2013-02-07T09:21:33+00:00amonnet
<div class="FormattedComment">
IDR jobs is to allocate both memory and a unique identifier, true ?<br>
I don't undestand why memory allocation does not fall on the caller side as usual.<br>
<p>
+++<br>
</div>