From: Anshuman Khandual <anshuman.khandual@arm.com>
To: Oscar Salvador <osalvador@suse.de>,
Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@redhat.com>,
Michal Hocko <mhocko@kernel.org>,
Vlastimil Babka <vbabka@suse.cz>,
Pavel Tatashin <pasha.tatashin@soleen.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm,memory_hotplug: Drop unneeded locking
Date: Tue, 1 Jun 2021 10:47:31 +0530 [thread overview]
Message-ID: <679d311a-8ad4-bb53-18f0-11190a2bf1b5@arm.com> (raw)
In-Reply-To: <20210531093958.15021-1-osalvador@suse.de>
On 5/31/21 3:09 PM, Oscar Salvador wrote:
> Currently, memory-hotplug code takes zone's span_writelock
> and pgdat's resize_lock when resizing the node/zone's spanned
> pages via {move_pfn_range_to_zone(),remove_pfn_range_from_zone()}
> and when resizing node and zone's present pages via
> adjust_present_page_count().
>
> These locks are also taken during the initialization of the system
> at boot time, where it protects parallel struct page initialization,
> but they should not really be needed in memory-hotplug where all
> operations are a) synchronized on device level and b) serialized by
> the mem_hotplug_lock lock.
>
> Signed-off-by: Oscar Salvador <osalvador@suse.de>
> Acked-by: David Hildenbrand <david@redhat.com>
> ---
> mm/memory_hotplug.c | 11 -----------
> 1 file changed, 11 deletions(-)
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 075b34803fec..9edbc57055bf 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -329,7 +329,6 @@ static void shrink_zone_span(struct zone *zone, unsigned long start_pfn,
> unsigned long pfn;
> int nid = zone_to_nid(zone);
>
> - zone_span_writelock(zone);
> if (zone->zone_start_pfn == start_pfn) {
> /*
> * If the section is smallest section in the zone, it need
> @@ -362,7 +361,6 @@ static void shrink_zone_span(struct zone *zone, unsigned long start_pfn,
> zone->spanned_pages = 0;
> }
> }
> - zone_span_writeunlock(zone);
> }
>
> static void update_pgdat_span(struct pglist_data *pgdat)
> @@ -424,10 +422,8 @@ void __ref remove_pfn_range_from_zone(struct zone *zone,
>
> clear_zone_contiguous(zone);
>
> - pgdat_resize_lock(zone->zone_pgdat, &flags);
> shrink_zone_span(zone, start_pfn, start_pfn + nr_pages);
> update_pgdat_span(pgdat);
> - pgdat_resize_unlock(zone->zone_pgdat, &flags);
>
> set_zone_contiguous(zone);
> }
> @@ -638,15 +634,10 @@ void __ref move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn,
>
> 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);
> if (zone_is_empty(zone))
> init_currently_empty_zone(zone, start_pfn, nr_pages);
> 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);
>
> /*
> * Subsection population requires care in pfn_to_online_page().
> @@ -739,9 +730,7 @@ void adjust_present_page_count(struct zone *zone, long nr_pages)
> unsigned long flags;
>
> zone->present_pages += nr_pages;
> - pgdat_resize_lock(zone->zone_pgdat, &flags);
> zone->zone_pgdat->node_present_pages += nr_pages;
> - pgdat_resize_unlock(zone->zone_pgdat, &flags);
> }
>
> int mhp_init_memmap_on_memory(unsigned long pfn, unsigned long nr_pages,
>
Should also just drop zone_span_write[lock|unlock]() helpers as there
are no users left ?
next prev parent reply other threads:[~2021-06-01 5:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-31 9:39 Oscar Salvador
2021-05-31 11:37 ` Michal Hocko
2021-06-01 5:17 ` Anshuman Khandual [this message]
2021-06-01 7:47 ` Oscar Salvador
2021-06-01 8:02 ` David Hildenbrand
2021-06-01 8:12 ` Oscar Salvador
2021-06-01 9:47 ` Michal Hocko
2021-06-01 10:33 ` Oscar Salvador
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=679d311a-8ad4-bb53-18f0-11190a2bf1b5@arm.com \
--to=anshuman.khandual@arm.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=osalvador@suse.de \
--cc=pasha.tatashin@soleen.com \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox