lkml.org 
[lkml]   [2018]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 3/3] docs: core-api: add memory allocation guide
On Tue, Sep 11, 2018 at 11:55:55AM -0600, Jonathan Corbet wrote:
> Sorry for being so slow to get to this...it fell into a dark crack in my
> rickety email folder hierarchy. I do have one question...
>
> On Fri, 17 Aug 2018 17:47:16 +0300
> Mike Rapoport <rppt@linux.vnet.ibm.com> wrote:
>
> > + ``GFP_HIGHUSER_MOVABLE`` does not require that allocated memory
> > + will be directly accessible by the kernel or the hardware and
> > + implies that the data is movable.
> > +
> > + ``GFP_HIGHUSER`` means that the allocated memory is not movable,
> > + but it is not required to be directly accessible by the kernel or
> > + the hardware. An example may be a hardware allocation that maps
> > + data directly into userspace but has no addressing limitations.
> > +
> > + ``GFP_USER`` means that the allocated memory is not movable and it
> > + must be directly accessible by the kernel or the hardware. It is
> > + typically used by hardware for buffers that are mapped to
> > + userspace (e.g. graphics) that hardware still must DMA to.
>
> I realize that this is copied from elsewhere, but still...as I understand
> it, the "HIGH" part means that the allocation can be satisfied from high
> memory, nothing more. So...it's irrelevant on 64-bit machines to start
> with, right? And it has nothing to do with DMA, I would think. That would
> be handled by the DMA infrastructure and, perhaps, the DMA* zones. Right?
>
> I ask because high memory is an artifact of how things are laid out on
> 32-bit systems; hardware can often DMA quite easily into memory that the
> kernel sees as "high". So, to me, this description seems kind of
> confusing; I wouldn't mention hardware at all. But maybe I'm missing
> something?

Well, I've amended the original text from gfp.h in attempt to make it more
"user friendly". The GFP_HIGHUSER became really confusing :)
I think that we can drop mentions of hardware from GFP_HIGHUSER_MOVABLE and
GFP_USER, but it makes sense to leave the example in the GFP_HIGHUSER
description.

How about:

``GFP_HIGHUSER_MOVABLE`` does not require that allocated memory
will be directly accessible by the kernel and implies that the
data is movable.

``GFP_HIGHUSER`` means that the allocated memory is not movable,
but it is not required to be directly accessible by the kernel. An
example may be a hardware allocation that maps data directly into
userspace but has no addressing limitations.

``GFP_USER`` means that the allocated memory is not movable and it
must be directly accessible by the kernel


> Thanks,
>
> jon
>

--
Sincerely yours,
Mike.

\
 
 \ /
  Last update: 2018-09-12 12:34    [W:0.075 / U:1.952 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site