[PATCH v2] vhost-vdpa: account iommu allocations

2023-12-26 Thread Pasha Tatashin
iommu allocations should be accounted in order to allow admins to monitor and limit the amount of iommu memory. Signed-off-by: Pasha Tatashin Acked-by: Michael S. Tsirkin --- drivers/vhost/vdpa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Changelog: v1: This patch is spinned

[PATCH] vhost-vdpa: account iommu allocations

2023-11-30 Thread Pasha Tatashin
iommu allocations should be accounted in order to allow admins to monitor and limit the amount of iommu memory. Signed-off-by: Pasha Tatashin --- drivers/vhost/vdpa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) This patch is spinned of from the series: https://lore.kernel.org/all

Re: [PATCH v1] virtio_pmem: populate numa information

2022-10-26 Thread Pasha Tatashin
g the numa node is taken from cxl_pmem_region_probe in > drivers/cxl/pmem.c. > > Signed-off-by: Michael Sammler Enables the hot-plugging of virtio-pmem memory into correct memory nodes. Does not look like it effect the FS_DAX. Reviewed-by: Pasha Tatashin Thanks, Pasha > --- >

Re: [mm PATCH v4 3/6] mm: Use memblock/zone specific iterator for handling deferred page init

2018-10-31 Thread Pasha Tatashin
On 10/31/18 12:05 PM, Alexander Duyck wrote: > On Wed, 2018-10-31 at 15:40 +0000, Pasha Tatashin wrote: >> >> On 10/17/18 7:54 PM, Alexander Duyck wrote: >>> This patch introduces a new iterator for_each_free_mem_pfn_range_in_zone. >>> >>> This iter

Re: [mm PATCH v4 3/6] mm: Use memblock/zone specific iterator for handling deferred page init

2018-10-31 Thread Pasha Tatashin
On 10/31/18 12:05 PM, Alexander Duyck wrote: > On Wed, 2018-10-31 at 15:40 +0000, Pasha Tatashin wrote: >> >> On 10/17/18 7:54 PM, Alexander Duyck wrote: >>> This patch introduces a new iterator for_each_free_mem_pfn_range_in_zone. >>> >>> This iter

Re: [mm PATCH v4 3/6] mm: Use memblock/zone specific iterator for handling deferred page init

2018-10-31 Thread Pasha Tatashin
On 10/17/18 7:54 PM, Alexander Duyck wrote: > This patch introduces a new iterator for_each_free_mem_pfn_range_in_zone. > > This iterator will take care of making sure a given memory range provided > is in fact contained within a zone. It takes are of all the bounds checking > we were doing in

Re: [mm PATCH v4 3/6] mm: Use memblock/zone specific iterator for handling deferred page init

2018-10-31 Thread Pasha Tatashin
On 10/17/18 7:54 PM, Alexander Duyck wrote: > This patch introduces a new iterator for_each_free_mem_pfn_range_in_zone. > > This iterator will take care of making sure a given memory range provided > is in fact contained within a zone. It takes are of all the bounds checking > we were doing in

Re: [PATCH v4 3/5] mm: Defer ZONE_DEVICE page initialization to the point where we init pgmap

2018-09-21 Thread Pasha Tatashin
On 9/20/18 6:29 PM, Alexander Duyck wrote: > The ZONE_DEVICE pages were being initialized in two locations. One was with > the memory_hotplug lock held and another was outside of that lock. The > problem with this is that it was nearly doubling the memory initialization > time. Instead of doing

Re: [PATCH v4 3/5] mm: Defer ZONE_DEVICE page initialization to the point where we init pgmap

2018-09-21 Thread Pasha Tatashin
On 9/20/18 6:29 PM, Alexander Duyck wrote: > The ZONE_DEVICE pages were being initialized in two locations. One was with > the memory_hotplug lock held and another was outside of that lock. The > problem with this is that it was nearly doubling the memory initialization > time. Instead of doing

Re: [PATCH v2 3/4] mm/memory_hotplug: Simplify node_states_check_changes_online

2018-09-21 Thread Pasha Tatashin
On 9/21/18 9:26 AM, Oscar Salvador wrote: > From: Oscar Salvador > > While looking at node_states_check_changes_online, I stumbled > upon some confusing things. > > Right after entering the function, we find this: > > if (N_MEMORY == N_NORMAL_MEMORY) > zone_last = ZONE_MOVABLE; > >

Re: [PATCH v2 3/4] mm/memory_hotplug: Simplify node_states_check_changes_online

2018-09-21 Thread Pasha Tatashin
On 9/21/18 9:26 AM, Oscar Salvador wrote: > From: Oscar Salvador > > While looking at node_states_check_changes_online, I stumbled > upon some confusing things. > > Right after entering the function, we find this: > > if (N_MEMORY == N_NORMAL_MEMORY) > zone_last = ZONE_MOVABLE; > >

Re: [PATCH 5/5] mm/memory_hotplug: Clean up node_states_check_changes_offline

2018-09-20 Thread Pasha Tatashin
On 9/19/18 6:08 AM, Oscar Salvador wrote: > From: Oscar Salvador > > This patch, as the previous one, gets rid of the wrong if statements. > While at it, I realized that the comments are sometimes very confusing, > to say the least, and wrong. > For example: > > --- > zone_last = ZONE_MOVABLE;

Re: [PATCH 5/5] mm/memory_hotplug: Clean up node_states_check_changes_offline

2018-09-20 Thread Pasha Tatashin
On 9/19/18 6:08 AM, Oscar Salvador wrote: > From: Oscar Salvador > > This patch, as the previous one, gets rid of the wrong if statements. > While at it, I realized that the comments are sometimes very confusing, > to say the least, and wrong. > For example: > > --- > zone_last = ZONE_MOVABLE;

Re: [PATCH 4/5] mm/memory_hotplug: Simplify node_states_check_changes_online

2018-09-20 Thread Pasha Tatashin
On 9/19/18 6:08 AM, Oscar Salvador wrote: > From: Oscar Salvador > > While looking at node_states_check_changes_online, I stumbled > upon some confusing things. > > Right after entering the function, we find this: > > if (N_MEMORY == N_NORMAL_MEMORY) > zone_last = ZONE_MOVABLE; > >

Re: [PATCH 4/5] mm/memory_hotplug: Simplify node_states_check_changes_online

2018-09-20 Thread Pasha Tatashin
On 9/19/18 6:08 AM, Oscar Salvador wrote: > From: Oscar Salvador > > While looking at node_states_check_changes_online, I stumbled > upon some confusing things. > > Right after entering the function, we find this: > > if (N_MEMORY == N_NORMAL_MEMORY) > zone_last = ZONE_MOVABLE; > >

Re: [PATCH 3/5] mm/memory_hotplug: Tidy up node_states_clear_node

2018-09-20 Thread Pasha Tatashin
On 9/19/18 6:08 AM, Oscar Salvador wrote: > From: Oscar Salvador > > node_states_clear has the following if statements: > > if ((N_MEMORY != N_NORMAL_MEMORY) && > (arg->status_change_nid_high >= 0)) > ... > > if ((N_MEMORY != N_HIGH_MEMORY) && > (arg->status_change_nid >= 0))

Re: [PATCH 3/5] mm/memory_hotplug: Tidy up node_states_clear_node

2018-09-20 Thread Pasha Tatashin
On 9/19/18 6:08 AM, Oscar Salvador wrote: > From: Oscar Salvador > > node_states_clear has the following if statements: > > if ((N_MEMORY != N_NORMAL_MEMORY) && > (arg->status_change_nid_high >= 0)) > ... > > if ((N_MEMORY != N_HIGH_MEMORY) && > (arg->status_change_nid >= 0))

Re: [PATCH 2/5] mm/memory_hotplug: Avoid node_set/clear_state(N_HIGH_MEMORY) when !CONFIG_HIGHMEM

2018-09-20 Thread Pasha Tatashin
On 9/19/18 6:08 AM, Oscar Salvador wrote: > From: Oscar Salvador > > Currently, when !CONFIG_HIGHMEM, status_change_nid_high is being set > to status_change_nid_normal, but on such systems N_HIGH_MEMORY falls > back to N_NORMAL_MEMORY. > That means that if status_change_nid_normal is not -1, >

Re: [PATCH 2/5] mm/memory_hotplug: Avoid node_set/clear_state(N_HIGH_MEMORY) when !CONFIG_HIGHMEM

2018-09-20 Thread Pasha Tatashin
On 9/19/18 6:08 AM, Oscar Salvador wrote: > From: Oscar Salvador > > Currently, when !CONFIG_HIGHMEM, status_change_nid_high is being set > to status_change_nid_normal, but on such systems N_HIGH_MEMORY falls > back to N_NORMAL_MEMORY. > That means that if status_change_nid_normal is not -1, >

Re: [PATCH 1/5] mm/memory_hotplug: Spare unnecessary calls to node_set_state

2018-09-20 Thread Pasha Tatashin
On 9/19/18 6:08 AM, Oscar Salvador wrote: > From: Oscar Salvador > > In node_states_check_changes_online, we check if the node will > have to be set for any of the N_*_MEMORY states after the pages > have been onlined. > > Later on, we perform the activation in node_states_set_node. >

Re: [PATCH 1/5] mm/memory_hotplug: Spare unnecessary calls to node_set_state

2018-09-20 Thread Pasha Tatashin
On 9/19/18 6:08 AM, Oscar Salvador wrote: > From: Oscar Salvador > > In node_states_check_changes_online, we check if the node will > have to be set for any of the N_*_MEMORY states after the pages > have been onlined. > > Later on, we perform the activation in node_states_set_node. >

Re: [PATCH] memory_hotplug: fix the panic when memory end is not on the section boundary

2018-09-12 Thread Pasha Tatashin
On 9/12/18 10:27 AM, Gerald Schaefer wrote: > On Wed, 12 Sep 2018 15:39:33 +0200 > Michal Hocko wrote: > >> On Wed 12-09-18 15:03:56, Gerald Schaefer wrote: >> [...] >>> BTW, those sysfs attributes are world-readable, so anyone can trigger >>> the panic by simply reading them, or just run

Re: [PATCH] memory_hotplug: fix the panic when memory end is not on the section boundary

2018-09-12 Thread Pasha Tatashin
On 9/12/18 10:27 AM, Gerald Schaefer wrote: > On Wed, 12 Sep 2018 15:39:33 +0200 > Michal Hocko wrote: > >> On Wed 12-09-18 15:03:56, Gerald Schaefer wrote: >> [...] >>> BTW, those sysfs attributes are world-readable, so anyone can trigger >>> the panic by simply reading them, or just run

Re: [PATCH] memory_hotplug: fix the panic when memory end is not on the section boundary

2018-09-10 Thread Pasha Tatashin
On 9/10/18 10:41 AM, Michal Hocko wrote: > On Mon 10-09-18 14:32:16, Pavel Tatashin wrote: >> On Mon, Sep 10, 2018 at 10:19 AM Michal Hocko wrote: >>> >>> On Mon 10-09-18 14:11:45, Pavel Tatashin wrote: Hi Michal, It is tricky, but probably can be done. Either change

Re: [PATCH] memory_hotplug: fix the panic when memory end is not on the section boundary

2018-09-10 Thread Pasha Tatashin
On 9/10/18 10:41 AM, Michal Hocko wrote: > On Mon 10-09-18 14:32:16, Pavel Tatashin wrote: >> On Mon, Sep 10, 2018 at 10:19 AM Michal Hocko wrote: >>> >>> On Mon 10-09-18 14:11:45, Pavel Tatashin wrote: Hi Michal, It is tricky, but probably can be done. Either change

Re: [PATCH] memory_hotplug: fix the panic when memory end is not on the section boundary

2018-09-10 Thread Pasha Tatashin
On Mon, Sep 10, 2018 at 10:19 AM Michal Hocko wrote: > > On Mon 10-09-18 14:11:45, Pavel Tatashin wrote: > > Hi Michal, > > > > It is tricky, but probably can be done. Either change > > memmap_init_zone() or its caller to also cover the ends and starts of > > unaligned sections to initialize and

Re: [PATCH] memory_hotplug: fix the panic when memory end is not on the section boundary

2018-09-10 Thread Pasha Tatashin
On Mon, Sep 10, 2018 at 10:19 AM Michal Hocko wrote: > > On Mon 10-09-18 14:11:45, Pavel Tatashin wrote: > > Hi Michal, > > > > It is tricky, but probably can be done. Either change > > memmap_init_zone() or its caller to also cover the ends and starts of > > unaligned sections to initialize and

Re: [PATCH] memory_hotplug: fix the panic when memory end is not on the section boundary

2018-09-10 Thread Pasha Tatashin
Hi Michal, It is tricky, but probably can be done. Either change memmap_init_zone() or its caller to also cover the ends and starts of unaligned sections to initialize and reserve pages. The same thing would also need to be done in deferred_init_memmap() to cover the deferred init case. For

Re: [PATCH] memory_hotplug: fix the panic when memory end is not on the section boundary

2018-09-10 Thread Pasha Tatashin
Hi Michal, It is tricky, but probably can be done. Either change memmap_init_zone() or its caller to also cover the ends and starts of unaligned sections to initialize and reserve pages. The same thing would also need to be done in deferred_init_memmap() to cover the deferred init case. For

Re: [PATCH] memory_hotplug: fix the panic when memory end is not on the section boundary

2018-09-10 Thread Pasha Tatashin
On 9/10/18 9:17 AM, Michal Hocko wrote: > [Cc Pavel] > > On Mon 10-09-18 14:35:27, Mikhail Zaslonko wrote: >> If memory end is not aligned with the linux memory section boundary, such >> a section is only partly initialized. This may lead to VM_BUG_ON due to >> uninitialized struct pages access

Re: [PATCH] memory_hotplug: fix the panic when memory end is not on the section boundary

2018-09-10 Thread Pasha Tatashin
On 9/10/18 9:17 AM, Michal Hocko wrote: > [Cc Pavel] > > On Mon 10-09-18 14:35:27, Mikhail Zaslonko wrote: >> If memory end is not aligned with the linux memory section boundary, such >> a section is only partly initialized. This may lead to VM_BUG_ON due to >> uninitialized struct pages access

Re: [PATCH] Revert "x86/tsc: Consolidate init code"

2018-09-10 Thread Pasha Tatashin
Hi Ville, The failure is surprising, because the commit is tiny, and almost does not change the code logic. From looking through the commit, the only functional difference this commit makes is: static_branch_enable(&__use_tsc) was called unconditionally from tsc_init(), but after the commit

Re: [PATCH] Revert "x86/tsc: Consolidate init code"

2018-09-10 Thread Pasha Tatashin
Hi Ville, The failure is surprising, because the commit is tiny, and almost does not change the code logic. From looking through the commit, the only functional difference this commit makes is: static_branch_enable(&__use_tsc) was called unconditionally from tsc_init(), but after the commit

Re: [PATCH v2 1/2] mm: Move page struct poisoning to CONFIG_DEBUG_VM_PAGE_INIT_POISON

2018-09-06 Thread Pasha Tatashin
On 9/6/18 1:03 PM, Michal Hocko wrote: > On Thu 06-09-18 08:41:52, Alexander Duyck wrote: >> On Thu, Sep 6, 2018 at 8:13 AM Michal Hocko wrote: >>> >>> On Thu 06-09-18 07:59:03, Dave Hansen wrote: On 09/05/2018 10:47 PM, Michal Hocko wrote: > why do you have to keep DEBUG_VM enabled

Re: [PATCH v2 1/2] mm: Move page struct poisoning to CONFIG_DEBUG_VM_PAGE_INIT_POISON

2018-09-06 Thread Pasha Tatashin
On 9/6/18 1:03 PM, Michal Hocko wrote: > On Thu 06-09-18 08:41:52, Alexander Duyck wrote: >> On Thu, Sep 6, 2018 at 8:13 AM Michal Hocko wrote: >>> >>> On Thu 06-09-18 07:59:03, Dave Hansen wrote: On 09/05/2018 10:47 PM, Michal Hocko wrote: > why do you have to keep DEBUG_VM enabled

Re: [PATCH v2 1/2] mm: Move page struct poisoning to CONFIG_DEBUG_VM_PAGE_INIT_POISON

2018-09-06 Thread Pasha Tatashin
On 9/6/18 11:41 AM, Alexander Duyck wrote: > On Thu, Sep 6, 2018 at 8:13 AM Michal Hocko wrote: >> >> On Thu 06-09-18 07:59:03, Dave Hansen wrote: >>> On 09/05/2018 10:47 PM, Michal Hocko wrote: why do you have to keep DEBUG_VM enabled for workloads where the boot time matters so much

Re: [PATCH v2 1/2] mm: Move page struct poisoning to CONFIG_DEBUG_VM_PAGE_INIT_POISON

2018-09-06 Thread Pasha Tatashin
On 9/6/18 11:41 AM, Alexander Duyck wrote: > On Thu, Sep 6, 2018 at 8:13 AM Michal Hocko wrote: >> >> On Thu 06-09-18 07:59:03, Dave Hansen wrote: >>> On 09/05/2018 10:47 PM, Michal Hocko wrote: why do you have to keep DEBUG_VM enabled for workloads where the boot time matters so much

Re: [PATCH v2 1/2] mm: Move page struct poisoning to CONFIG_DEBUG_VM_PAGE_INIT_POISON

2018-09-05 Thread Pasha Tatashin
On 9/5/18 5:29 PM, Alexander Duyck wrote: > On Wed, Sep 5, 2018 at 2:22 PM Pasha Tatashin > wrote: >> >> >> >> On 9/5/18 5:13 PM, Alexander Duyck wrote: >>> From: Alexander Duyck >>> >>> On systems with a large amount of memory it ca

Re: [PATCH v2 1/2] mm: Move page struct poisoning to CONFIG_DEBUG_VM_PAGE_INIT_POISON

2018-09-05 Thread Pasha Tatashin
On 9/5/18 5:29 PM, Alexander Duyck wrote: > On Wed, Sep 5, 2018 at 2:22 PM Pasha Tatashin > wrote: >> >> >> >> On 9/5/18 5:13 PM, Alexander Duyck wrote: >>> From: Alexander Duyck >>> >>> On systems with a large amount of memory it ca

Re: [PATCH v2 1/2] mm: Move page struct poisoning to CONFIG_DEBUG_VM_PAGE_INIT_POISON

2018-09-05 Thread Pasha Tatashin
On 9/5/18 5:13 PM, Alexander Duyck wrote: > From: Alexander Duyck > > On systems with a large amount of memory it can take a significant amount > of time to initialize all of the page structs with the PAGE_POISON_PATTERN > value. I have seen it take over 2 minutes to initialize a system with >

Re: [PATCH v2 1/2] mm: Move page struct poisoning to CONFIG_DEBUG_VM_PAGE_INIT_POISON

2018-09-05 Thread Pasha Tatashin
On 9/5/18 5:13 PM, Alexander Duyck wrote: > From: Alexander Duyck > > On systems with a large amount of memory it can take a significant amount > of time to initialize all of the page structs with the PAGE_POISON_PATTERN > value. I have seen it take over 2 minutes to initialize a system with >

Re: [PATCH 2/2] mm: Create non-atomic version of SetPageReserved for init use

2018-09-05 Thread Pasha Tatashin
On 9/5/18 4:18 PM, Alexander Duyck wrote: > On Tue, Sep 4, 2018 at 11:24 PM Michal Hocko wrote: >> >> On Tue 04-09-18 11:33:45, Alexander Duyck wrote: >>> From: Alexander Duyck >>> >>> It doesn't make much sense to use the atomic SetPageReserved at init time >>> when we are using memset to

Re: [PATCH 2/2] mm: Create non-atomic version of SetPageReserved for init use

2018-09-05 Thread Pasha Tatashin
On 9/5/18 4:18 PM, Alexander Duyck wrote: > On Tue, Sep 4, 2018 at 11:24 PM Michal Hocko wrote: >> >> On Tue 04-09-18 11:33:45, Alexander Duyck wrote: >>> From: Alexander Duyck >>> >>> It doesn't make much sense to use the atomic SetPageReserved at init time >>> when we are using memset to

Re: Plumbers 2018 - Performance and Scalability Microconference

2018-09-05 Thread Pasha Tatashin
On 9/5/18 2:38 AM, Mike Rapoport wrote: > On Tue, Sep 04, 2018 at 05:28:13PM -0400, Daniel Jordan wrote: >> Pavel Tatashin, Ying Huang, and I are excited to be organizing a performance >> and scalability microconference this year at Plumbers[*], which is happening >> in Vancouver this year.

Re: Plumbers 2018 - Performance and Scalability Microconference

2018-09-05 Thread Pasha Tatashin
On 9/5/18 2:38 AM, Mike Rapoport wrote: > On Tue, Sep 04, 2018 at 05:28:13PM -0400, Daniel Jordan wrote: >> Pavel Tatashin, Ying Huang, and I are excited to be organizing a performance >> and scalability microconference this year at Plumbers[*], which is happening >> in Vancouver this year.

Re: [PATCH 1/2] mm: Move page struct poisoning from CONFIG_DEBUG_VM to CONFIG_DEBUG_VM_PGFLAGS

2018-09-04 Thread Pasha Tatashin
On 9/4/18 5:13 PM, Alexander Duyck wrote: > On Tue, Sep 4, 2018 at 1:07 PM Pasha Tatashin > wrote: >> >> Hi Alexander, >> >> This is a wrong way to do it. memblock_virt_alloc_try_nid_raw() does not >> initialize allocated memory, and by setting memory to

Re: [PATCH 1/2] mm: Move page struct poisoning from CONFIG_DEBUG_VM to CONFIG_DEBUG_VM_PGFLAGS

2018-09-04 Thread Pasha Tatashin
On 9/4/18 5:13 PM, Alexander Duyck wrote: > On Tue, Sep 4, 2018 at 1:07 PM Pasha Tatashin > wrote: >> >> Hi Alexander, >> >> This is a wrong way to do it. memblock_virt_alloc_try_nid_raw() does not >> initialize allocated memory, and by setting memory to

Re: [PATCH 1/2] mm: Move page struct poisoning from CONFIG_DEBUG_VM to CONFIG_DEBUG_VM_PGFLAGS

2018-09-04 Thread Pasha Tatashin
Hi Alexander, This is a wrong way to do it. memblock_virt_alloc_try_nid_raw() does not initialize allocated memory, and by setting memory to all ones in debug build we ensure that no callers rely on this function to return zeroed memory just by accident. And, the accidents are frequent because

Re: [PATCH 1/2] mm: Move page struct poisoning from CONFIG_DEBUG_VM to CONFIG_DEBUG_VM_PGFLAGS

2018-09-04 Thread Pasha Tatashin
Hi Alexander, This is a wrong way to do it. memblock_virt_alloc_try_nid_raw() does not initialize allocated memory, and by setting memory to all ones in debug build we ensure that no callers rely on this function to return zeroed memory just by accident. And, the accidents are frequent because

[PATCH] mm: Disable deferred struct page for 32-bit arches

2018-08-31 Thread Pasha Tatashin
Deferred struct page init is needed only on systems with large amount of physical memory to improve boot performance. 32-bit systems do not benefit from this feature. Jiri reported a problem where deferred struct pages do not work well with x86-32: [0.035162] Dentry cache hash table entries:

[PATCH] mm: Disable deferred struct page for 32-bit arches

2018-08-31 Thread Pasha Tatashin
Deferred struct page init is needed only on systems with large amount of physical memory to improve boot performance. 32-bit systems do not benefit from this feature. Jiri reported a problem where deferred struct pages do not work well with x86-32: [0.035162] Dentry cache hash table entries:

Re: [PATCH] mm/page_alloc: Clean up check_for_memory

2018-08-31 Thread Pasha Tatashin
On 8/31/18 8:24 AM, Oscar Salvador wrote: > On Thu, Aug 30, 2018 at 01:55:29AM +0000, Pasha Tatashin wrote: >> I would re-write the above function like this: >> static void check_for_memory(pg_data_t *pgdat, int nid) >> { >> enum zone_type zone_type; >&

Re: [PATCH] mm/page_alloc: Clean up check_for_memory

2018-08-31 Thread Pasha Tatashin
On 8/31/18 8:24 AM, Oscar Salvador wrote: > On Thu, Aug 30, 2018 at 01:55:29AM +0000, Pasha Tatashin wrote: >> I would re-write the above function like this: >> static void check_for_memory(pg_data_t *pgdat, int nid) >> { >> enum zone_type zone_type; >&

Re: [PATCH v1 5/5] mm/memory_hotplug: print only with DEBUG_VM in online/offline_pages()

2018-08-30 Thread Pasha Tatashin
On 8/20/18 6:46 AM, David Hildenbrand wrote: > On 16.08.2018 12:06, David Hildenbrand wrote: >> Let's try to minimze the noise. >> >> Signed-off-by: David Hildenbrand >> --- >> mm/memory_hotplug.c | 6 ++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/mm/memory_hotplug.c

Re: [PATCH v1 5/5] mm/memory_hotplug: print only with DEBUG_VM in online/offline_pages()

2018-08-30 Thread Pasha Tatashin
On 8/20/18 6:46 AM, David Hildenbrand wrote: > On 16.08.2018 12:06, David Hildenbrand wrote: >> Let's try to minimze the noise. >> >> Signed-off-by: David Hildenbrand >> --- >> mm/memory_hotplug.c | 6 ++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/mm/memory_hotplug.c

Re: [PATCH v1 4/5] mm/memory_hotplug: onlining pages can only fail due to notifiers

2018-08-30 Thread Pasha Tatashin
LGTM Reviewed-by: Pavel Tatashin On 8/16/18 6:06 AM, David Hildenbrand wrote: > Onlining pages can only fail if a notifier reported a problem (e.g. -ENOMEM). > online_pages_range() can never fail. > > Signed-off-by: David Hildenbrand > --- > mm/memory_hotplug.c | 9 ++--- > 1 file

Re: [PATCH v1 4/5] mm/memory_hotplug: onlining pages can only fail due to notifiers

2018-08-30 Thread Pasha Tatashin
LGTM Reviewed-by: Pavel Tatashin On 8/16/18 6:06 AM, David Hildenbrand wrote: > Onlining pages can only fail if a notifier reported a problem (e.g. -ENOMEM). > online_pages_range() can never fail. > > Signed-off-by: David Hildenbrand > --- > mm/memory_hotplug.c | 9 ++--- > 1 file

Re: [PATCH v1 3/5] mm/memory_hotplug: check if sections are already online/offline

2018-08-30 Thread Pasha Tatashin
On 8/16/18 7:00 AM, David Hildenbrand wrote: > On 16.08.2018 12:47, Oscar Salvador wrote: >> On Thu, Aug 16, 2018 at 12:06:26PM +0200, David Hildenbrand wrote: >> >>> + >>> +/* check if all mem sections are offline */ >>> +bool mem_sections_offline(unsigned long pfn, unsigned long end_pfn) >>> +{

Re: [PATCH v1 3/5] mm/memory_hotplug: check if sections are already online/offline

2018-08-30 Thread Pasha Tatashin
On 8/16/18 7:00 AM, David Hildenbrand wrote: > On 16.08.2018 12:47, Oscar Salvador wrote: >> On Thu, Aug 16, 2018 at 12:06:26PM +0200, David Hildenbrand wrote: >> >>> + >>> +/* check if all mem sections are offline */ >>> +bool mem_sections_offline(unsigned long pfn, unsigned long end_pfn) >>> +{

Re: [PATCH v1 2/5] mm/memory_hotplug: enforce section alignment when onlining/offlining

2018-08-30 Thread Pasha Tatashin
Hi David, I am not sure this is needed, because we already have a stricter checker: check_hotplug_memory_range() You could call it from online_pages(), if you think there is a reason to do it, but other than that it is done from add_memory_resource() and from remove_memory(). Thank you, Pavel

Re: [PATCH v1 2/5] mm/memory_hotplug: enforce section alignment when onlining/offlining

2018-08-30 Thread Pasha Tatashin
Hi David, I am not sure this is needed, because we already have a stricter checker: check_hotplug_memory_range() You could call it from online_pages(), if you think there is a reason to do it, but other than that it is done from add_memory_resource() and from remove_memory(). Thank you, Pavel

Re: [PATCH v1 1/5] mm/memory_hotplug: drop intermediate __offline_pages

2018-08-30 Thread Pasha Tatashin
On 8/30/18 4:17 PM, Pasha Tatashin wrote: > I guess the wrap was done because of __ref, but no reason to have this > wrap. So looks good to me. > > Reviewed-by: Pavel Tatashin > > On 8/16/18 6:06 AM, David Hildenbrand wrote: >> Let's avoid this indirection an

Re: [PATCH v1 1/5] mm/memory_hotplug: drop intermediate __offline_pages

2018-08-30 Thread Pasha Tatashin
On 8/30/18 4:17 PM, Pasha Tatashin wrote: > I guess the wrap was done because of __ref, but no reason to have this > wrap. So looks good to me. > > Reviewed-by: Pavel Tatashin > > On 8/16/18 6:06 AM, David Hildenbrand wrote: >> Let's avoid this indirection an

Re: [PATCH v1 1/5] mm/memory_hotplug: drop intermediate __offline_pages

2018-08-30 Thread Pasha Tatashin
I guess the wrap was done because of __ref, but no reason to have this wrap. So looks good to me. Reviewed-by: Pavel Tatashin On 8/16/18 6:06 AM, David Hildenbrand wrote: > Let's avoid this indirection and just call the function offline_pages(). > > Signed-off-by: David Hildenbrand > --- >

Re: [PATCH v1 1/5] mm/memory_hotplug: drop intermediate __offline_pages

2018-08-30 Thread Pasha Tatashin
I guess the wrap was done because of __ref, but no reason to have this wrap. So looks good to me. Reviewed-by: Pavel Tatashin On 8/16/18 6:06 AM, David Hildenbrand wrote: > Let's avoid this indirection and just call the function offline_pages(). > > Signed-off-by: David Hildenbrand > --- >

Re: [PATCH] mm/page_alloc: Clean up check_for_memory

2018-08-29 Thread Pasha Tatashin
On 8/28/18 5:01 PM, Oscar Salvador wrote: > From: Oscar Salvador > > check_for_memory looks a bit confusing. > First of all, we have this: > > if (N_MEMORY == N_NORMAL_MEMORY) > return; > > Checking the ENUM declaration, looks like N_MEMORY canot be equal to > N_NORMAL_MEMORY. > I

Re: [PATCH] mm/page_alloc: Clean up check_for_memory

2018-08-29 Thread Pasha Tatashin
On 8/28/18 5:01 PM, Oscar Salvador wrote: > From: Oscar Salvador > > check_for_memory looks a bit confusing. > First of all, we have this: > > if (N_MEMORY == N_NORMAL_MEMORY) > return; > > Checking the ENUM declaration, looks like N_MEMORY canot be equal to > N_NORMAL_MEMORY. > I

Re: [RFC v2 2/2] mm/memory_hotplug: Shrink spanned pages when offlining memory

2018-08-29 Thread Pasha Tatashin
On 8/17/18 11:41 AM, Oscar Salvador wrote: > From: Oscar Salvador > > 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

Re: [RFC v2 2/2] mm/memory_hotplug: Shrink spanned pages when offlining memory

2018-08-29 Thread Pasha Tatashin
On 8/17/18 11:41 AM, Oscar Salvador wrote: > From: Oscar Salvador > > 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

Re: [PATCH] memory_hotplug: fix kernel_panic on offline page processing

2018-08-28 Thread Pasha Tatashin
On 8/28/18 7:25 AM, Michal Hocko wrote: > On Tue 28-08-18 11:05:39, Mikhail Zaslonko wrote: >> Within show_valid_zones() the function test_pages_in_a_zone() should be >> called for online memory blocks only. Otherwise it might lead to the >> VM_BUG_ON due to uninitialized struct pages (when

Re: [PATCH] memory_hotplug: fix kernel_panic on offline page processing

2018-08-28 Thread Pasha Tatashin
On 8/28/18 7:25 AM, Michal Hocko wrote: > On Tue 28-08-18 11:05:39, Mikhail Zaslonko wrote: >> Within show_valid_zones() the function test_pages_in_a_zone() should be >> called for online memory blocks only. Otherwise it might lead to the >> VM_BUG_ON due to uninitialized struct pages (when

Re: [PATCH v4 3/4] mm/memory_hotplug: Define nodemask_t as a stack variable

2018-08-28 Thread Pasha Tatashin
On 8/17/18 5:00 AM, Oscar Salvador wrote: > From: Oscar Salvador > > Currently, unregister_mem_sect_under_nodes() tries to allocate a nodemask_t > in order to check whithin the loop which nodes have already been unlinked, > so we do not repeat the operation on them. > > NODEMASK_ALLOC calls

Re: [PATCH v4 3/4] mm/memory_hotplug: Define nodemask_t as a stack variable

2018-08-28 Thread Pasha Tatashin
On 8/17/18 5:00 AM, Oscar Salvador wrote: > From: Oscar Salvador > > Currently, unregister_mem_sect_under_nodes() tries to allocate a nodemask_t > in order to check whithin the loop which nodes have already been unlinked, > so we do not repeat the operation on them. > > NODEMASK_ALLOC calls

Re: [PATCH 2/2] mm: zero remaining unavailable struct pages

2018-08-27 Thread Pasha Tatashin
On 8/23/18 2:25 PM, Masayoshi Mizuma wrote: > From: Naoya Horiguchi > > There is a kernel panic that is triggered when reading /proc/kpageflags > on the kernel booted with kernel parameter 'memmap=nn[KMG]!ss[KMG]': > > BUG: unable to handle kernel paging request at fffe > PGD

Re: [PATCH 2/2] mm: zero remaining unavailable struct pages

2018-08-27 Thread Pasha Tatashin
On 8/23/18 2:25 PM, Masayoshi Mizuma wrote: > From: Naoya Horiguchi > > There is a kernel panic that is triggered when reading /proc/kpageflags > on the kernel booted with kernel parameter 'memmap=nn[KMG]!ss[KMG]': > > BUG: unable to handle kernel paging request at fffe > PGD

Re: [PATCH 1/2] Revert "x86/e820: put !E820_TYPE_RAM regions into memblock.reserved"

2018-08-27 Thread Pasha Tatashin
On 8/23/18 2:25 PM, Masayoshi Mizuma wrote: > From: Masayoshi Mizuma > > commit 124049decbb1 ("x86/e820: put !E820_TYPE_RAM regions into > memblock.reserved") breaks movable_node kernel option because it > changed the memory gap range to reserved memblock. So, the node > is marked as Normal zone

Re: [PATCH 1/2] Revert "x86/e820: put !E820_TYPE_RAM regions into memblock.reserved"

2018-08-27 Thread Pasha Tatashin
On 8/23/18 2:25 PM, Masayoshi Mizuma wrote: > From: Masayoshi Mizuma > > commit 124049decbb1 ("x86/e820: put !E820_TYPE_RAM regions into > memblock.reserved") breaks movable_node kernel option because it > changed the memory gap range to reserved memblock. So, the node > is marked as Normal zone

Re: [PATCH 1/2] Revert "x86/e820: put !E820_TYPE_RAM regions into memblock.reserved"

2018-08-27 Thread Pasha Tatashin
On Mon, Aug 27, 2018 at 8:31 AM Masayoshi Mizuma wrote: > > Hi Pavel, > > I would appreciate if you could send the feedback for the patch. I will study it today. Pavel > > Thanks! > Masa > > On 08/24/2018 04:29 AM, Michal Hocko wrote: > > On Fri 24-08-18 00:03:25, Naoya Horiguchi wrote: > >>

Re: [PATCH 1/2] Revert "x86/e820: put !E820_TYPE_RAM regions into memblock.reserved"

2018-08-27 Thread Pasha Tatashin
On Mon, Aug 27, 2018 at 8:31 AM Masayoshi Mizuma wrote: > > Hi Pavel, > > I would appreciate if you could send the feedback for the patch. I will study it today. Pavel > > Thanks! > Masa > > On 08/24/2018 04:29 AM, Michal Hocko wrote: > > On Fri 24-08-18 00:03:25, Naoya Horiguchi wrote: > >>

Re: [RESEND PATCH v10 6/6] mm: page_alloc: reduce unnecessary binary search in early_pfn_valid()

2018-08-16 Thread Pasha Tatashin
On 7/6/18 5:01 AM, Jia He wrote: > Commit b92df1de5d28 ("mm: page_alloc: skip over regions of invalid pfns > where possible") optimized the loop in memmap_init_zone(). But there is > still some room for improvement. E.g. in early_pfn_valid(), if pfn and > pfn+1 are in the same memblock region,

Re: [RESEND PATCH v10 6/6] mm: page_alloc: reduce unnecessary binary search in early_pfn_valid()

2018-08-16 Thread Pasha Tatashin
On 7/6/18 5:01 AM, Jia He wrote: > Commit b92df1de5d28 ("mm: page_alloc: skip over regions of invalid pfns > where possible") optimized the loop in memmap_init_zone(). But there is > still some room for improvement. E.g. in early_pfn_valid(), if pfn and > pfn+1 are in the same memblock region,

Re: [RESEND PATCH v10 3/6] mm: page_alloc: reduce unnecessary binary search in memblock_next_valid_pfn()

2018-08-16 Thread Pasha Tatashin
On 8/16/18 9:08 PM, Pavel Tatashin wrote: > >> Signed-off-by: Jia He >> --- >> mm/memblock.c | 37 + >> 1 file changed, 29 insertions(+), 8 deletions(-) >> >> diff --git a/mm/memblock.c b/mm/memblock.c >> index ccad225..84f7fa7 100644 >> --- a/mm/memblock.c

Re: [RESEND PATCH v10 3/6] mm: page_alloc: reduce unnecessary binary search in memblock_next_valid_pfn()

2018-08-16 Thread Pasha Tatashin
On 8/16/18 9:08 PM, Pavel Tatashin wrote: > >> Signed-off-by: Jia He >> --- >> mm/memblock.c | 37 + >> 1 file changed, 29 insertions(+), 8 deletions(-) >> >> diff --git a/mm/memblock.c b/mm/memblock.c >> index ccad225..84f7fa7 100644 >> --- a/mm/memblock.c

Re: [RESEND PATCH v10 3/6] mm: page_alloc: reduce unnecessary binary search in memblock_next_valid_pfn()

2018-08-16 Thread Pasha Tatashin
> Signed-off-by: Jia He > --- > mm/memblock.c | 37 + > 1 file changed, 29 insertions(+), 8 deletions(-) > > diff --git a/mm/memblock.c b/mm/memblock.c > index ccad225..84f7fa7 100644 > --- a/mm/memblock.c > +++ b/mm/memblock.c > @@ -1140,31 +1140,52 @@ int

Re: [RESEND PATCH v10 3/6] mm: page_alloc: reduce unnecessary binary search in memblock_next_valid_pfn()

2018-08-16 Thread Pasha Tatashin
> Signed-off-by: Jia He > --- > mm/memblock.c | 37 + > 1 file changed, 29 insertions(+), 8 deletions(-) > > diff --git a/mm/memblock.c b/mm/memblock.c > index ccad225..84f7fa7 100644 > --- a/mm/memblock.c > +++ b/mm/memblock.c > @@ -1140,31 +1140,52 @@ int

Re: [RESEND PATCH v10 2/6] mm: page_alloc: remain memblock_next_valid_pfn() on arm/arm64

2018-08-16 Thread Pasha Tatashin
On 18-07-06 17:01:11, Jia He wrote: > From: Jia He > > Commit b92df1de5d28 ("mm: page_alloc: skip over regions of invalid pfns > where possible") optimized the loop in memmap_init_zone(). But it causes > possible panic bug. So Daniel Vacek reverted it later. > > But as suggested by Daniel

Re: [RESEND PATCH v10 2/6] mm: page_alloc: remain memblock_next_valid_pfn() on arm/arm64

2018-08-16 Thread Pasha Tatashin
On 18-07-06 17:01:11, Jia He wrote: > From: Jia He > > Commit b92df1de5d28 ("mm: page_alloc: skip over regions of invalid pfns > where possible") optimized the loop in memmap_init_zone(). But it causes > possible panic bug. So Daniel Vacek reverted it later. > > But as suggested by Daniel

Re: [RESEND PATCH v10 0/6] optimize memblock_next_valid_pfn and early_pfn_valid on arm and arm64

2018-08-16 Thread Pasha Tatashin
On 18-08-15 15:34:56, Andrew Morton wrote: > On Fri, 6 Jul 2018 17:01:09 +0800 Jia He wrote: > > > Commit b92df1de5d28 ("mm: page_alloc: skip over regions of invalid pfns > > where possible") optimized the loop in memmap_init_zone(). But it causes > > possible panic bug. So Daniel Vacek

Re: [RESEND PATCH v10 0/6] optimize memblock_next_valid_pfn and early_pfn_valid on arm and arm64

2018-08-16 Thread Pasha Tatashin
On 18-08-15 15:34:56, Andrew Morton wrote: > On Fri, 6 Jul 2018 17:01:09 +0800 Jia He wrote: > > > Commit b92df1de5d28 ("mm: page_alloc: skip over regions of invalid pfns > > where possible") optimized the loop in memmap_init_zone(). But it causes > > possible panic bug. So Daniel Vacek

Re: [PATCH v3 4/4] mm/memory_hotplug: Drop node_online check in unregister_mem_sect_under_nodes

2018-08-16 Thread Pasha Tatashin
On 18-08-15 16:42:19, Oscar Salvador wrote: > From: Oscar Salvador > > We are getting the nid from the pages that are not yet removed, > but a node can only be offline when its memory/cpu's have been removed. > Therefore, we know that the node is still online. Reviewed-by: Pavel Tatashin > >

Re: [PATCH v3 4/4] mm/memory_hotplug: Drop node_online check in unregister_mem_sect_under_nodes

2018-08-16 Thread Pasha Tatashin
On 18-08-15 16:42:19, Oscar Salvador wrote: > From: Oscar Salvador > > We are getting the nid from the pages that are not yet removed, > but a node can only be offline when its memory/cpu's have been removed. > Therefore, we know that the node is still online. Reviewed-by: Pavel Tatashin > >

Re: [PATCH v3 3/4] mm/memory_hotplug: Refactor unregister_mem_sect_under_nodes

2018-08-16 Thread Pasha Tatashin
> > d) What's the maximum number of nodes, ever? Perhaps we can always > >fit a nodemask_t onto the stack, dunno. > > Right now, we define the maximum as NODES_SHIFT = 10, so: > > 1 << 10 = 1024 Maximum nodes. > > Since this makes only 128 bytes, I wonder if we can just go ahead and define

Re: [PATCH v3 3/4] mm/memory_hotplug: Refactor unregister_mem_sect_under_nodes

2018-08-16 Thread Pasha Tatashin
> > d) What's the maximum number of nodes, ever? Perhaps we can always > >fit a nodemask_t onto the stack, dunno. > > Right now, we define the maximum as NODES_SHIFT = 10, so: > > 1 << 10 = 1024 Maximum nodes. > > Since this makes only 128 bytes, I wonder if we can just go ahead and define

Re: [PATCH v3 2/4] mm/memory_hotplug: Drop mem_blk check from unregister_mem_sect_under_nodes

2018-08-16 Thread Pasha Tatashin
On 18-08-15 16:42:17, Oscar Salvador wrote: > From: Oscar Salvador > > Before calling to unregister_mem_sect_under_nodes(), > remove_memory_section() already checks if we got a valid memory_block. > > No need to check that again in unregister_mem_sect_under_nodes(). > > If more functions start

Re: [PATCH v3 2/4] mm/memory_hotplug: Drop mem_blk check from unregister_mem_sect_under_nodes

2018-08-16 Thread Pasha Tatashin
On 18-08-15 16:42:17, Oscar Salvador wrote: > From: Oscar Salvador > > Before calling to unregister_mem_sect_under_nodes(), > remove_memory_section() already checks if we got a valid memory_block. > > No need to check that again in unregister_mem_sect_under_nodes(). > > If more functions start

Re: [PATCH v3 1/4] mm/memory-hotplug: Drop unused args from remove_memory_section

2018-08-16 Thread Pasha Tatashin
On 18-08-15 16:42:16, Oscar Salvador wrote: > From: Oscar Salvador > > unregister_memory_section() calls remove_memory_section() > with three arguments: > > * node_id > * section > * phys_device > > Neither node_id nor phys_device are used. > Let us drop them from the function. Looks good:

Re: [PATCH v3 1/4] mm/memory-hotplug: Drop unused args from remove_memory_section

2018-08-16 Thread Pasha Tatashin
On 18-08-15 16:42:16, Oscar Salvador wrote: > From: Oscar Salvador > > unregister_memory_section() calls remove_memory_section() > with three arguments: > > * node_id > * section > * phys_device > > Neither node_id nor phys_device are used. > Let us drop them from the function. Looks good:

Re: [PATCH v2 3/4] mm/memory_hotplug: Make register_mem_sect_under_node a cb of walk_memory_range

2018-08-16 Thread Pasha Tatashin
On 18-06-22 13:18:38, osalva...@techadventures.net wrote: > From: Oscar Salvador > > link_mem_sections() and walk_memory_range() share most of the code, > so we can use convert link_mem_sections() into a dummy function that calls > walk_memory_range() with a callback to

Re: [PATCH v2 3/4] mm/memory_hotplug: Make register_mem_sect_under_node a cb of walk_memory_range

2018-08-16 Thread Pasha Tatashin
On 18-06-22 13:18:38, osalva...@techadventures.net wrote: > From: Oscar Salvador > > link_mem_sections() and walk_memory_range() share most of the code, > so we can use convert link_mem_sections() into a dummy function that calls > walk_memory_range() with a callback to

Re: [PATCH v10 05/10] mm: zero reserved and unavailable struct pages

2017-10-06 Thread Pasha Tatashin
Hi Michal, As I've said in other reply this should go in only if the scenario you describe is real. I am somehow suspicious to be honest. I simply do not see how those weird struct pages would be in a valid pfn range of any zone. There are examples of both when unavailable memory is not

  1   2   3   >