Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1526360

Re: [HMM v13 01/18] mm/memory/hotplug: convert device parameter bool to set of flags

From Jerome Glisse <jglisse@redhat.com>
Newsgroups linux.kernel
Subject Re: [HMM v13 01/18] mm/memory/hotplug: convert device parameter bool to set of flags
Date 2016-11-21 06:00 +0100
Message-ID <sFORY-4Q0-17@gated-at.bofh.it> (permalink)
References <sEUZr-1B7-3@gated-at.bofh.it> <sEUZr-1B7-1@gated-at.bofh.it> <sFKY1-2m8-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Nov 21, 2016 at 11:44:36AM +1100, Balbir Singh wrote:
> 
> 
> On 19/11/16 05:18, Jérôme Glisse wrote:
> > Only usefull for arch where we support ZONE_DEVICE and where we want to
> > also support un-addressable device memory. We need struct page for such
> > un-addressable memory. But we should avoid populating the kernel linear
> > mapping for the physical address range because there is no real memory
> > or anything behind those physical address.
> > 
> > Hence we need more flags than just knowing if it is device memory or not.
> > 
> 
> 
> Isn't it better to add a wrapper to arch_add/remove_memory and do those
> checks inside and then call arch_add/remove_memory to reduce the churn.
> If you need selectively enable MEMORY_UNADDRESSABLE that can be done with
> _ARCH_HAS_FEATURE

The flag parameter can be use by other new features and thus i thought the
churn was fine. But i do not mind either way, whatever people like best.

[...]

> > -extern int arch_add_memory(int nid, u64 start, u64 size, bool for_device);
> > +
> > +/*
> > + * For device memory we want more informations than just knowing it is device
> 				     information
> > + * memory. We want to know if we can migrate it (ie it is not storage memory
> > + * use by DAX). Is it addressable by the CPU ? Some device memory like GPU
> > + * memory can not be access by CPU but we still want struct page so that we
> 			accessed
> > + * can use it like regular memory.
> 
> Can you please add some details on why -- migration needs them for example?

I am not sure what you mean ? DAX ie persistent memory device is intended to be
use for filesystem or persistent storage. Hence memory migration does not apply
to it (it would go against its purpose).

So i want to extend ZONE_DEVICE to be more then just DAX/persistent memory. For
that i need to differentatiate between device memory that can be migrated and
should be more or less treated like regular memory (with struct page). This is
what the MEMORY_MOVABLE flag is for.

Finaly in my case the device memory is not accessible by the CPU so i need yet
another flag. In the end i am extending ZONE_DEVICE to be use for 3 differents
type of memory.

Is this the kind of explanation you are looking for ?

> > + */
> > +#define MEMORY_FLAGS_NONE 0
> > +#define MEMORY_DEVICE (1 << 0)
> > +#define MEMORY_MOVABLE (1 << 1)
> > +#define MEMORY_UNADDRESSABLE (1 << 2)

Cheers,
Jérôme

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[HMM v13 01/18] mm/memory/hotplug: convert device parameter bool to set of flags Jérôme Glisse <jglisse@redhat.com> - 2016-11-18 18:20 +0100
  Re: [HMM v13 01/18] mm/memory/hotplug: convert device parameter bool  to set of flags Balbir Singh <bsingharora@gmail.com> - 2016-11-21 01:50 +0100
    Re: [HMM v13 01/18] mm/memory/hotplug: convert device parameter bool  to set of flags Jerome Glisse <jglisse@redhat.com> - 2016-11-21 06:00 +0100
      Re: [HMM v13 01/18] mm/memory/hotplug: convert device parameter bool  to set of flags Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-11-21 08:00 +0100
        Re: [HMM v13 01/18] mm/memory/hotplug: convert device parameter bool  to set of flags Jerome Glisse <jglisse@redhat.com> - 2016-11-21 13:20 +0100
  Re: [HMM v13 01/18] mm/memory/hotplug: convert device parameter bool  to set of flags Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-11-21 07:50 +0100
    Re: [HMM v13 01/18] mm/memory/hotplug: convert device parameter bool  to set of flags Jerome Glisse <jglisse@redhat.com> - 2016-11-21 13:30 +0100
      Re: [HMM v13 01/18] mm/memory/hotplug: convert device parameter bool  to set of flags Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-11-22 06:40 +0100
        Re: [HMM v13 01/18] mm/memory/hotplug: convert device parameter bool  to set of flags Jerome Glisse <jglisse@redhat.com> - 2016-11-22 15:10 +0100

csiph-web