From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753161AbdHOP70 (ORCPT ); Tue, 15 Aug 2017 11:59:26 -0400 Received: from mga14.intel.com ([192.55.52.115]:40458 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752275AbdHOP7Z (ORCPT ); Tue, 15 Aug 2017 11:59:25 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,378,1498546800"; d="scan'208";a="890191017" Date: Wed, 16 Aug 2017 00:01:08 +0800 From: Chen Yu To: Michal Hocko Cc: linux-mm@kvack.org, linux-pm@vger.kernel.org, Andrew Morton , Vlastimil Babka , Mel Gorman , linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , Len Brown , Dan Williams Subject: Re: [PATCH][RFC] PM / Hibernate: Feed NMI wathdog when creating snapshot Message-ID: <20170815160107.GA2541@yu-desktop-1.sh.intel.com> References: <1502731156-24903-1-git-send-email-yu.c.chen@intel.com> <20170815124119.GG29067@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170815124119.GG29067@dhcp22.suse.cz> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Michal, On Tue, Aug 15, 2017 at 02:41:19PM +0200, Michal Hocko wrote: > On Tue 15-08-17 01:19:16, Chen Yu wrote: > [...] > > @@ -2561,8 +2562,10 @@ void mark_free_pages(struct zone *zone) > > unsigned long i; > > > > pfn = page_to_pfn(page); > > - for (i = 0; i < (1UL << order); i++) > > + for (i = 0; i < (1UL << order); i++) { > > swsusp_set_page_free(pfn_to_page(pfn + i)); > > + touch_nmi_watchdog(); > > + } > > this is rather excessive. Why don't you simply call touch_nmi_watchdog > once per every 1000 pages? Or once per free_list entry? > Yes, this would be less costy, previously I thought that, since touch_nmi_watchdog() would only update very limited amount of percpu variables and it is not costy when comparing with the huge loop in radix tree searching by the swsusp_set_page_free(), thus I put it in the deepest level in this loop, as this might be a safer place to avoid NMI. > Moreover why don't you need to touch_nmi_watchdog in the loop over all > pfns in the zone (right above this loop)? As the NMI was triggered when checking the free_list rather than in the loop over all pfns, it seems that the former has more possibility to catch a NMI if the latter has already taken too much time. But yes, a safer way is to feed dog in the latter too. I'll modify the code according to your suggestion. Thanks, Yu > -- > Michal Hocko > SUSE Labs