[PATCH] Re: [dm-devel] kmalloc after down_write?

Ming Zhang mingz at ele.uri.edu
Fri Nov 19 20:27:57 UTC 2004


en, yes, kmalloc first is better way. since this register_snapshot is
not called frequently(only in ctr), the extra overhead brought by always
doing kmalloc is minor. but down_write while possible sleep is bad for
the do_origin() since it is called by origina_map().

ming


On Fri, 2004-11-19 at 15:16, Kevin Corry wrote:
> On Friday 19 November 2004 12:36 pm, Ming Zhang wrote:
> > yes, i know. semaphore can sleep. but why not release lock, kmalloc, and
> > regain lock? i think any code should reduce the chance that make others
> > wait for it. especially it hold a write lock, not a read lock.
> 
> Releasing the lock and regaining it means having to search the hash table
> all over again to make sure another process hasn't added a new entry for
> the same origin. Very wasteful. If we're simply concerned about the amount
> of time that we're holding that semaphore, the following patch would do it.




More information about the dm-devel mailing list