tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Temporary memory allocation from interrupt context



On Wed, Nov 11, 2020 at 08:26:45AM -0500, Greg Troxel wrote:
> > 	LOCK(st);
> > 	size_t n, max_n = st->num_items;
> > 	some_state_item **tmp_list =
> > 	    kmem_intr_alloc(max_n * sizeof(*tmp_list));
> 
> kmem_intr_alloc takes a flag, and it seems that you need to pass
> KM_NOSLEEP, as blocking for memory in softint context is highly unlikely
> to be the right thing.

Yes, and of course the real code has that (and works). It's just that 
 - memoryallocators(9) does not cover this case
 - kmem_intr_alloc(9) is kinda deprecated - quoting the man page:

	These routines are for the special cases.  Normally,
	pool_cache(9) should be used for memory allocation from interrupt
	context.

   but how would I use pool_cache(9) here?

Martin


Home | Main Index | Thread Index | Old Index