linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Arun KS <arunks@codeaurora.org>
Cc: Michal Hocko <mhocko@kernel.org>,
	Alexander Duyck <alexander.h.duyck@linux.intel.com>,
	arunks.linux@gmail.com, vbabka@suse.cz, osalvador@suse.de,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	getarunks@gmail.com
Subject: Re: [PATCH v7] mm/page_alloc.c: memory_hotplug: free pages as higher order
Date: Wed, 9 Jan 2019 10:56:52 -0800	[thread overview]
Message-ID: <20190109105652.40e24fa969a2bb7a58e097a8@linux-foundation.org> (raw)
In-Reply-To: <2efb06e91d9af48bf3d1d38bd50e0458@codeaurora.org>

On Wed, 09 Jan 2019 16:36:36 +0530 Arun KS <arunks@codeaurora.org> wrote:

> On 2019-01-09 16:27, Michal Hocko wrote:
> > On Wed 09-01-19 16:12:48, Arun KS wrote:
> > [...]
> >> It will be called once per online of a section and the arg value is 
> >> always
> >> set to 0 while entering online_pages_range.
> > 
> > You rare right that this will be the case in the most simple scenario.
> > But the point is that the callback can be called several times from
> > walk_system_ram_range and then your current code wouldn't work 
> > properly.
> 
> Thanks. Will use +=

The v8 patch
https://lore.kernel.org/lkml/1547032395-24582-1-git-send-email-arunks@codeaurora.org/T/#u

(which you apparently sent 7 minutes after typing the above) still has

 static int online_pages_range(unsigned long start_pfn, unsigned long nr_pages,
 			void *arg)
 {
-	unsigned long i;
 	unsigned long onlined_pages = *(unsigned long *)arg;
-	struct page *page;
 
 	if (PageReserved(pfn_to_page(start_pfn)))
-		for (i = 0; i < nr_pages; i++) {
-			page = pfn_to_page(start_pfn + i);
-			(*online_page_callback)(page);
-			onlined_pages++;
-		}
+		onlined_pages = online_pages_blocks(start_pfn, nr_pages);


Even then the code makes no sense.

static int online_pages_range(unsigned long start_pfn, unsigned long nr_pages,
			void *arg)
{
	unsigned long onlined_pages = *(unsigned long *)arg;

	if (PageReserved(pfn_to_page(start_pfn)))
		onlined_pages += online_pages_blocks(start_pfn, nr_pages);

	online_mem_sections(start_pfn, start_pfn + nr_pages);

	*(unsigned long *)arg += onlined_pages;
	return 0;
}

Either the final assignment should be

	*(unsigned long *)arg = onlined_pages;

or the initialization should be

	unsigned long onlined_pages = 0;



This is becoming a tad tiresome and I'd prefer not to have to check up
on such things.  Can we please get this right?  

  reply	other threads:[~2019-01-09 18:56 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-04  5:01 Arun KS
2019-01-08 17:56 ` Alexander Duyck
2019-01-08 17:56   ` Alexander Duyck
2019-01-08 18:13   ` Michal Hocko
2019-01-09  5:58     ` Arun KS
2019-01-09  7:37       ` Michal Hocko
2019-01-09  8:28         ` Arun KS
2019-01-09  8:40           ` Michal Hocko
2019-01-09 10:42             ` Arun KS
2019-01-09 10:57               ` Michal Hocko
2019-01-09 11:06                 ` Arun KS
2019-01-09 18:56                   ` Andrew Morton [this message]
2019-01-10  5:06                     ` Arun KS
2019-01-08 18:40 ` Alexander Duyck
2019-01-08 18:40   ` Alexander Duyck
2019-01-08 20:04   ` Michal Hocko
2019-01-08 21:53     ` Alexander Duyck
2019-01-08 21:53       ` Alexander Duyck
2019-01-08 22:17 ` Alexander Duyck
2019-01-08 22:17   ` Alexander Duyck
2019-01-09  6:21   ` Arun KS
2019-01-09 16:09     ` Alexander Duyck
2019-01-09 16:09       ` Alexander Duyck
2019-01-10  4:39       ` Arun KS

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=20190109105652.40e24fa969a2bb7a58e097a8@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=alexander.h.duyck@linux.intel.com \
    --cc=arunks.linux@gmail.com \
    --cc=arunks@codeaurora.org \
    --cc=getarunks@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=osalvador@suse.de \
    --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