lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 29 Aug 2018 23:09:01 +0000
From:   Pasha Tatashin <Pavel.Tatashin@...rosoft.com>
To:     Oscar Salvador <osalvador@...hadventures.net>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>
CC:     "mhocko@...e.com" <mhocko@...e.com>,
        "dan.j.williams@...el.com" <dan.j.williams@...el.com>,
        "jglisse@...hat.com" <jglisse@...hat.com>,
        "david@...hat.com" <david@...hat.com>,
        "jonathan.cameron@...wei.com" <jonathan.cameron@...wei.com>,
        "yasu.isimatu@...il.com" <yasu.isimatu@...il.com>,
        "logang@...tatee.com" <logang@...tatee.com>,
        "dave.jiang@...el.com" <dave.jiang@...el.com>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Oscar Salvador <osalvador@...e.de>
Subject: Re: [RFC v2 2/2] mm/memory_hotplug: Shrink spanned pages when
 offlining memory


On 8/17/18 11:41 AM, Oscar Salvador wrote:
> From: Oscar Salvador <osalvador@...e.de>
> 
> Currently, we decrement zone/node spanned_pages when we
> remove memory and not when we offline it.
> 
> This, besides of not being consistent with the current code,
> implies that we can access steal pages if we never get to online
> that memory.
> 
> In order to prevent that, we have to move all zone/pages stuff to
> the offlining memory stage.
> Removing memory path should only care about memory sections and memory
> blocks.
> 
> Another thing to notice here is that this is not so easy to be done
> as HMM/devm have a particular handling of memory-hotplug.
> They do not go through the common path, and so, they do not
> call either offline_pages() nor online_pages().
> 
> All they care about is to add the sections, move the pages to
> ZONE_DEVICE, and in some cases, to create the linear mapping.
> 
> In order to do this more smooth, two new functions are created
> to deal with these particular cases:
> 
> del_device_memory
> add_device_memory
> 
> add_device_memory is in charge of
> 
> a) calling either arch_add_memory() or add_pages(), depending on whether
>    we want a linear mapping
> b) online the memory sections that correspond to the pfn range
> c) calling move_pfn_range_to_zone() being zone ZONE_DEVICE to
>    expand zone/pgdat spanned pages and initialize its pages
> 
> del_device_memory, on the other hand, is in charge of
> 
> a) offline the memory sections that correspond to the pfn range
> b) calling shrink_pages(), which shrinks node/zone spanned pages.
> c) calling either arch_remove_memory() or __remove_pages(), depending on
>    whether we need to tear down the linear mapping or not
> 
> These two functions are called from:
> 
> add_device_memory:
> 	- devm_memremap_pages()
> 	- hmm_devmem_pages_create()
> 
> del_device_memory:
> 	- devm_memremap_pages_release()
> 	- hmm_devmem_release()
> 
> I think that this will get easier as soon as [1] gets merged.
> 
> Finally, shrink_pages() is moved to offline_pages(), so now,
> all pages/zone handling is being taken care in online/offline_pages stage.
> 
> [1] https://lkml.org/lkml/2018/6/19/110
> 
> Signed-off-by: Oscar Salvador <osalvador@...e.de>
> ---
>  arch/ia64/mm/init.c            |   4 +-
>  arch/powerpc/mm/mem.c          |  10 +--
>  arch/sh/mm/init.c              |   4 +-
>  arch/x86/mm/init_32.c          |   4 +-
>  arch/x86/mm/init_64.c          |   8 +--
>  include/linux/memory_hotplug.h |   9 ++-
>  kernel/memremap.c              |  14 ++--
>  kernel/resource.c              |  16 +++++
>  mm/hmm.c                       |  32 ++++-----
>  mm/memory_hotplug.c            | 143 +++++++++++++++++++++++++++--------------
>  mm/sparse.c                    |   4 +-
>  11 files changed, 145 insertions(+), 103 deletions(-)

Hi Oscar,

I have been studying this patch, and do not see anything bad about it
except that it begs to be split into smaller patches. I think you can
send this work as a series without RFC if this patch is split into 3 or
so patches. I will review that series.

Thank you,
Pavel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ