Re: Disposal of a misleading M_TRYWAIT



On Sat, Mar 22, 2008 at 09:01:23PM -0700, Sam Leffler wrote:
We made a decision a while back to not use malloc flags for mbuf routine
arguments.

While I can see the point in this (if we ever change the
mbuf allocator from UMA to something else), like I said
in my email, a lot of code already uses malloc flags for
this.

There are even assertions to verify it.

I think this was OBE, now mbuf.h says:

: /*
: * Flags specifying how an allocation should be made.
: *
: * The flag to use is as follows:
: * - M_DONTWAIT or M_NOWAIT from an interrupt handler to not block allocation.
: * - M_WAIT or M_WAITOK from wherever it is safe to block.
: *
: * M_DONTWAIT/M_NOWAIT means that we will not block the thread explicitly and
: * if we cannot allocate immediately we may return NULL, whereas
: * M_WAIT/M_WAITOK means that if we cannot allocate resources we
: * will block until they are available, and thus never return NULL.
: *
: * XXX Eventually just phase this out to use M_WAITOK/M_NOWAIT.
: */
: #define MBTOM(how) (how)
: #define M_DONTWAIT M_NOWAIT
: #define M_TRYWAIT M_WAITOK
: #define M_WAIT M_WAITOK


Cheers,
--
Ruslan Ermilov
ru@xxxxxxxxxxx
FreeBSD committer
_______________________________________________
freebsd-arch@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: Disposal of a misleading M_TRYWAIT
    ... mbuf allocator from UMA to something else), ... a lot of code already uses malloc flags for ... * Flags specifying how an allocation should be made. ...
    (freebsd-arch)
  • [PATCH] type safe allocator
    ... pointer cast to 'type *'. ... * @flags: the type of memory to allocate. ... Allocator specific definitions. ... -but the corresponding sizeof that is passed to a memory allocator is not. ...
    (Linux-Kernel)
  • Re: [PATCH] add __GFP_ZERO to GFP_LEVEL_MASK
    ... non of the zone specifiers are ... GFP_LEVEL_MASK contains the flags that are passed to the page allocator ... by derived allocators (such as slab allocators and vmalloc, ...
    (Linux-Kernel)
  • Re: mbuma: network buffers & UMA
    ... > I would like to commit this RSN. ... I haven't looked at the diff in detail (the largest part seems to be ... to have a UMA based mbuf system in 5-CURRENT and 5.3R. ... This basically gets rid of the existing mbuf allocator and replaces ...
    (freebsd-arch)
  • Re: Reboot while booting with new per-CPU allocator
    ... On Thu, 16 Jun 2005, Robert Watson wrote: ... >> allocator now. ... > types now get allocated from UMA. ... there's been a bunch of reports of this in the past few ...
    (freebsd-current)