Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Dec 1998 15:23:16 -0500 (EST)
From:      "John S. Dyson" <dyson@iquest.net>
To:        dyson@iquest.net
Cc:        julian@whistle.com, dillon@apollo.backplane.com, dyson@iquest.net, hackers@FreeBSD.ORG
Subject:   Re: M_KERNEL in sys/malloc.h ???
Message-ID:  <199812242023.PAA50865@y.dyson.net>
In-Reply-To: <199812242017.PAA50847@y.dyson.net> from "John S. Dyson" at "Dec 24, 98 03:17:29 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
John S. Dyson said:
> Julian Elischer said:
> >
> > I would rename it to M_RESERVED or something that indicates
> > that this is a request that is allowed dip into the emergency reserves
> > to satisfy the request.
> > 
> > > :> 
> > > :As I remember, M_KERNEL means that it really needs memory.  waiting
> > > :for memory is bad, and dip deeply into the page reserves.  Normally, the
> > > :malloc (in vm_kern) code will only dip into the interrupt accessible
> > > :free pages.  The M_KERNEL allows it to dip into all of the pages.
> > > 
> > 
> That isn't what it really does.  In reality, malloc normally grabs
> memory from the interrupt available queues.  The M_KERNEL relaxes the
> restriction so that more memory is available.  M_KERNEL cannot
> be used from interrupt time.
> 
Following up:

	M_WAITOK	--	Get any pages, but block if you cannot get them
	M_NOWAIT	--	Get only interrupt available pages, but don't block.
	M_KERNEL	--	Get any pages, but don't block

M_KERNEL is used to keep the VM from deadlocking, and should mostly be
used in the pagers.

M_WAITOK should normally be used in the non-interrupt part of the kernel
except when M_KERNEL is more appropriate.

M_NOWAIT should normally be used in the interrupt part of the kernel, but
can be used elsewhere.

If you rename, you might want to call M_KERNEL: M_VMREQ or somesuch to
note that this is a vm deadlock avoidance compromise.


-- 
John                  | Never try to teach a pig to sing,
dyson@iquest.net      | it makes one look stupid
jdyson@nc.com         | and it irritates the pig.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812242023.PAA50865>