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


Groups > linux.kernel > #1718097

Re: [PATCH][v2] PM / Hibernate: Feed the wathdog when creating snapshot

From Michal Hocko <mhocko@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH][v2] PM / Hibernate: Feed the wathdog when creating snapshot
Date 2017-08-23 09:20 +0200
Message-ID <uhy7h-5VC-23@gated-at.bofh.it> (permalink)
References <uh7Tr-4Tu-1@gated-at.bofh.it> <uhh6r-2PY-21@gated-at.bofh.it> <uhuQ1-3KW-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH][v2] PM / Hibernate: Feed the wathdog when creating snapshot Chen Yu <yu.c.chen@intel.com> - 2017-08-22 05:20 +0200
  Re: [PATCH][v2] PM / Hibernate: Feed the wathdog when creating snapshot "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-08-22 15:10 +0200
    Re: [PATCH][v2] PM / Hibernate: Feed the wathdog when creating  snapshot Michal Hocko <mhocko@kernel.org> - 2017-08-22 15:20 +0200
      Re: [PATCH][v2] PM / Hibernate: Feed the wathdog when creating snapshot "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-08-22 15:30 +0200
    Re: [PATCH][v2] PM / Hibernate: Feed the wathdog when creating  snapshot Chen Yu <yu.c.chen@intel.com> - 2017-08-23 05:50 +0200
      Re: [PATCH][v2] PM / Hibernate: Feed the wathdog when creating  snapshot Michal Hocko <mhocko@kernel.org> - 2017-08-23 09:20 +0200
      Re: [PATCH][v2] PM / Hibernate: Feed the wathdog when creating snapshot "Rafael J. Wysocki" <rafael@kernel.org> - 2017-08-23 18:30 +0200

csiph-web