vasily postnicov <[email protected]> added the comment:

Some code from usb_mem.c:

/*
 * Do not free the memory unconditionally since we might be called
 * from an interrupt context and that is BAD.
 * XXX when should we really free?
 */
static void
usb_block_freemem(usb_dma_block_t *p)
{
        DPRINTFN(6, ("usb_block_freemem: size=%lu\n", (u_long)p->size));
        logmemory(blkfree, p, NULL, p->size, p->align);
        crit_enter();
        LIST_INSERT_HEAD(&usb_blk_freelist, p, next);
        usb_blk_nfree++;
        crit_exit();
}

So it, actually, does not free memory, does it?

Here is some code from NetBSD I found:

http://fxr.watson.org/fxr/source/dev/usb/usb_mem.c?v=NETBSD;im=10

As you can see, there is some function called usb_block_real_freemem, but (as I
understand) it is never compiled (it is between #if 0/#endif).

What is "interrupt context" and why it is so dangerous?

_____________________________________________________
DragonFly issue tracker <[email protected]>
<http://bugs.dragonflybsd.org/issue1884>
_____________________________________________________

Reply via email to