Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
PostgreSQL 9.3 beta: Federated databases and more
LWN.net Weekly Edition for May 9, 2013
(Nearly) full tickless operation in 3.10
A simplified IDR API
Posted Feb 7, 2013 14:21 UTC (Thu) by corbet (editor, #1)
Posted Feb 7, 2013 14:49 UTC (Thu) by amonnet (subscriber, #54852)
Posted Feb 7, 2013 14:55 UTC (Thu) by corbet (editor, #1)
id = idr_allocate_id(gfp_flags); /* non-atomic context */
idr_assign_id(id, pointer); /* Can be atomic */
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 idr_never_mind() function to back things out if need be.
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds