On 2019-01-09 13:07, Michal Hocko wrote:
On Wed 09-01-19 11:28:52, Arun KS wrote:
On 2019-01-08 23:43, Michal Hocko wrote:
> On Tue 08-01-19 09:56:09, Alexander Duyck wrote:
> > On Fri, 2019-01-04 at 10:31 +0530, Arun KS wrote:
> [...]
> > >  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);
> >
> > Shouldn't this be a "+=" instead of an "="? It seems like you are
> > going
> > to lose your count otherwise.
>
> You are right of course. I should have noticed during the review.
> Thanks!

I think we don't need to. The caller function is setting onlined_pages = 0
before calling online_pages_range().
And there are no other reference to online_pages_range other than from
online_pages().

Are you missing that we accumulate onlined_pages via
        *(unsigned long *)arg = onlined_pages;
in online_pages_range?

In my testing I didn't find any problem. To match the code being replaced and to avoid any corner cases, it is better to use +=
Will update the patch.

Regards,
Arun

Reply via email to