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


Groups > linux.kernel > #1667515 > unrolled thread

Re: [PATCH 11/14] mm, memory_hotplug: do not associate hotadded memory to zones until online

Started byWei Yang <richard.weiyang@gmail.com>
First post2017-06-16 10:20 +0200
Last post2017-06-16 11:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 11/14] mm, memory_hotplug: do not associate hotadded  memory to zones until online Wei Yang <richard.weiyang@gmail.com> - 2017-06-16 10:20 +0200
    Re: [PATCH 11/14] mm, memory_hotplug: do not associate hotadded  memory to zones until online Michal Hocko <mhocko@kernel.org> - 2017-06-16 10:50 +0200
      Re: [PATCH 11/14] mm, memory_hotplug: do not associate hotadded  memory to zones until online Wei Yang <richard.weiyang@gmail.com> - 2017-06-16 11:20 +0200

#1667515 — Re: [PATCH 11/14] mm, memory_hotplug: do not associate hotadded memory to zones until online

FromWei Yang <richard.weiyang@gmail.com>
Date2017-06-16 10:20 +0200
SubjectRe: [PATCH 11/14] mm, memory_hotplug: do not associate hotadded memory to zones until online
Message-ID<tSUE1-5WD-5@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

Well, I love this patch a lot. We don't need to put the hotadd memory in one
zone and move it to another. This looks great!

On Mon, May 15, 2017 at 10:58:24AM +0200, Michal Hocko wrote:
>From: Michal Hocko <mhocko@suse.com>
>
[...]
+
>+void move_pfn_range_to_zone(struct zone *zone,
>+		unsigned long start_pfn, unsigned long nr_pages)
>+{
>+	struct pglist_data *pgdat = zone->zone_pgdat;
>+	int nid = pgdat->node_id;
>+	unsigned long flags;
>+	unsigned long i;
>+
>+	if (zone_is_empty(zone))
>+		init_currently_empty_zone(zone, start_pfn, nr_pages);
>+
>+	clear_zone_contiguous(zone);
>+
>+	/* TODO Huh pgdat is irqsave while zone is not. It used to be like that before */
>+	pgdat_resize_lock(pgdat, &flags);
>+	zone_span_writelock(zone);
>+	resize_zone_range(zone, start_pfn, nr_pages);
>+	zone_span_writeunlock(zone);
>+	resize_pgdat_range(pgdat, start_pfn, nr_pages);
>+	pgdat_resize_unlock(pgdat, &flags);
>+
>+	/*
>+	 * TODO now we have a visible range of pages which are not associated
>+	 * with their zone properly. Not nice but set_pfnblock_flags_mask
>+	 * expects the zone spans the pfn range. All the pages in the range
>+	 * are reserved so nobody should be touching them so we should be safe
>+	 */
>+	memmap_init_zone(nr_pages, nid, zone_idx(zone), start_pfn, MEMMAP_HOTPLUG);
>+	for (i = 0; i < nr_pages; i++) {
>+		unsigned long pfn = start_pfn + i;
>+		set_page_links(pfn_to_page(pfn), zone_idx(zone), nid, pfn);
> 	}

memmap_init_zone()->__init_single_page()->set_page_links()

Do I miss something that you call set_page_links() explicitly here?

-- 
Wei Yang
Help you, Help me

[toc] | [next] | [standalone]


#1667534

FromMichal Hocko <mhocko@kernel.org>
Date2017-06-16 10:50 +0200
Message-ID<tSV74-67Z-17@gated-at.bofh.it>
In reply to#1667515
On Fri 16-06-17 16:11:42, Wei Yang wrote:
> Well, I love this patch a lot. We don't need to put the hotadd memory in one
> zone and move it to another. This looks great!
> 
> On Mon, May 15, 2017 at 10:58:24AM +0200, Michal Hocko wrote:
> >From: Michal Hocko <mhocko@suse.com>
> >
> [...]
> +
> >+void move_pfn_range_to_zone(struct zone *zone,
> >+		unsigned long start_pfn, unsigned long nr_pages)
> >+{
> >+	struct pglist_data *pgdat = zone->zone_pgdat;
> >+	int nid = pgdat->node_id;
> >+	unsigned long flags;
> >+	unsigned long i;
> >+
> >+	if (zone_is_empty(zone))
> >+		init_currently_empty_zone(zone, start_pfn, nr_pages);
> >+
> >+	clear_zone_contiguous(zone);
> >+
> >+	/* TODO Huh pgdat is irqsave while zone is not. It used to be like that before */
> >+	pgdat_resize_lock(pgdat, &flags);
> >+	zone_span_writelock(zone);
> >+	resize_zone_range(zone, start_pfn, nr_pages);
> >+	zone_span_writeunlock(zone);
> >+	resize_pgdat_range(pgdat, start_pfn, nr_pages);
> >+	pgdat_resize_unlock(pgdat, &flags);
> >+
> >+	/*
> >+	 * TODO now we have a visible range of pages which are not associated
> >+	 * with their zone properly. Not nice but set_pfnblock_flags_mask
> >+	 * expects the zone spans the pfn range. All the pages in the range
> >+	 * are reserved so nobody should be touching them so we should be safe
> >+	 */
> >+	memmap_init_zone(nr_pages, nid, zone_idx(zone), start_pfn, MEMMAP_HOTPLUG);
> >+	for (i = 0; i < nr_pages; i++) {
> >+		unsigned long pfn = start_pfn + i;
> >+		set_page_links(pfn_to_page(pfn), zone_idx(zone), nid, pfn);
> > 	}
> 
> memmap_init_zone()->__init_single_page()->set_page_links()
> 
> Do I miss something that you call set_page_links() explicitly here?

I guess you are right. Not sure why I've done this explicitly. I've most
probably just missed that. Could you post a patch that removes the for
loop.

Thanks!
-- 
Michal Hocko
SUSE Labs

[toc] | [prev] | [next] | [standalone]


#1667567

FromWei Yang <richard.weiyang@gmail.com>
Date2017-06-16 11:20 +0200
Message-ID<tSVA5-6x9-7@gated-at.bofh.it>
In reply to#1667534

[Multipart message — attachments visible in raw view] — view raw

On Fri, Jun 16, 2017 at 10:45:55AM +0200, Michal Hocko wrote:
>On Fri 16-06-17 16:11:42, Wei Yang wrote:
>> Well, I love this patch a lot. We don't need to put the hotadd memory in one
>> zone and move it to another. This looks great!
>> 
>> On Mon, May 15, 2017 at 10:58:24AM +0200, Michal Hocko wrote:
>> >From: Michal Hocko <mhocko@suse.com>
>> >
>> [...]
>> +
>> >+void move_pfn_range_to_zone(struct zone *zone,
>> >+		unsigned long start_pfn, unsigned long nr_pages)
>> >+{
>> >+	struct pglist_data *pgdat = zone->zone_pgdat;
>> >+	int nid = pgdat->node_id;
>> >+	unsigned long flags;
>> >+	unsigned long i;
>> >+
>> >+	if (zone_is_empty(zone))
>> >+		init_currently_empty_zone(zone, start_pfn, nr_pages);
>> >+
>> >+	clear_zone_contiguous(zone);
>> >+
>> >+	/* TODO Huh pgdat is irqsave while zone is not. It used to be like that before */
>> >+	pgdat_resize_lock(pgdat, &flags);
>> >+	zone_span_writelock(zone);
>> >+	resize_zone_range(zone, start_pfn, nr_pages);
>> >+	zone_span_writeunlock(zone);
>> >+	resize_pgdat_range(pgdat, start_pfn, nr_pages);
>> >+	pgdat_resize_unlock(pgdat, &flags);
>> >+
>> >+	/*
>> >+	 * TODO now we have a visible range of pages which are not associated
>> >+	 * with their zone properly. Not nice but set_pfnblock_flags_mask
>> >+	 * expects the zone spans the pfn range. All the pages in the range
>> >+	 * are reserved so nobody should be touching them so we should be safe
>> >+	 */
>> >+	memmap_init_zone(nr_pages, nid, zone_idx(zone), start_pfn, MEMMAP_HOTPLUG);
>> >+	for (i = 0; i < nr_pages; i++) {
>> >+		unsigned long pfn = start_pfn + i;
>> >+		set_page_links(pfn_to_page(pfn), zone_idx(zone), nid, pfn);
>> > 	}
>> 
>> memmap_init_zone()->__init_single_page()->set_page_links()
>> 
>> Do I miss something that you call set_page_links() explicitly here?
>
>I guess you are right. Not sure why I've done this explicitly. I've most
>probably just missed that. Could you post a patch that removes the for
>loop.
>

Sure, I will come up with two patches based on you auto-latest branch.

>Thanks!
>-- 
>Michal Hocko
>SUSE Labs

-- 
Wei Yang
Help you, Help me

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web