From: Michal Hocko <mhocko@kernel.org>
To: Chen Yu <yu.c.chen@intel.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
Mel Gorman <mgorman@techsingularity.net>,
Vlastimil Babka <vbabka@suse.cz>, Len Brown <lenb@kernel.org>,
Dan Williams <dan.j.williams@intel.com>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][v2] PM / Hibernate: Feed the wathdog when creating snapshot
Date: Wed, 23 Aug 2017 09:14:52 +0200 [thread overview]
Message-ID: <20170823071452.GB2647@dhcp22.suse.cz> (raw)
In-Reply-To: <20170823034439.GA29634@yu-desktop-1.sh.intel.com>
On Wed 23-08-17 11:44:39, Chen Yu wrote:
> On Tue, Aug 22, 2017 at 02:55:39PM +0200, Rafael J. Wysocki wrote:
> > On Tuesday, August 22, 2017 5:20:02 AM CEST Chen Yu wrote:
[...]
> > > void mark_free_pages(struct zone *zone)
> > > {
> > > - unsigned long pfn, max_zone_pfn;
> > > + unsigned long pfn, max_zone_pfn, page_num = 0;
> >
> > + unsigned long pfn, max_zone_pfn, page_count = WD_PAGE_COUNT;
> >
> > > unsigned long flags;
> > > unsigned int order, t;
> > > struct page *page;
> > > @@ -2552,6 +2559,9 @@ void mark_free_pages(struct zone *zone)
> > > if (pfn_valid(pfn)) {
> > > page = pfn_to_page(pfn);
> > >
> > > + if (!((page_num++) % WD_INTERVAL_PAGE))
> > > + touch_nmi_watchdog();
> > > +
> >
> > ->
> >
> > if (!--page_count) {
> > touch_nmi_watchdog();
> > page_count = WD_PAGE_COUNT;
> > }
> >
> I guess this is to avoid the possible overflow if the page number is too large?
Even if the page_count overflown it wouldn't be a problem because of the
unsigned arithmetic. To be honest I find yours modulo based approach
easier to follow. Maybe it even compiles to a better code but I haven't
checked. Anyway one way or the other both ways are reasonable so
whatever Rafael (as the maintainer) prefers.
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-08-23 7:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-22 3:20 Chen Yu
2017-08-22 12:55 ` Rafael J. Wysocki
2017-08-22 13:16 ` Michal Hocko
2017-08-22 13:18 ` Rafael J. Wysocki
2017-08-23 3:44 ` Chen Yu
2017-08-23 7:14 ` Michal Hocko [this message]
2017-08-23 16:21 ` Rafael J. Wysocki
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=20170823071452.GB2647@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-pm@vger.kernel.org \
--cc=mgorman@techsingularity.net \
--cc=rjw@rjwysocki.net \
--cc=vbabka@suse.cz \
--cc=yu.c.chen@intel.com \
/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