Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4910782imm; Tue, 16 Oct 2018 01:57:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV603pj6OzuMBS1muhCN2aYpGB2eBZITr+AJpx0PJ1IgNoshRS2EIinY73ypZJm9i4Av/YXz7 X-Received: by 2002:a17:902:507:: with SMTP id 7-v6mr11847953plf.272.1539680266946; Tue, 16 Oct 2018 01:57:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539680266; cv=none; d=google.com; s=arc-20160816; b=ai5EQ+CcDJ/7LeoOTeV5peYz6NpfqnZ1IJDR/hRGqURvvuUM4hybbw5a7ixok9dT8e GxHLAeDjPOsBJ8Enxk9OeRAERUbD2OF9xSi3BdMZbiYNHATj5zT8bzR1jOTVVQ/pbTa2 WYCItuXG3gg/cN10+06mWIDZQF/L9AzdtA0cfr4FgfkIjTE1IHz+pVup3nQsrunykTEf Nhqu22/s6a60YfO1NAGIlKofvwa1j20fSzPw4XTj10oqwTCke4MswNaShc8tBIQIu2t9 xULe9I81A51qH1eEWX7hllLWosqdfwG+qGvcw9IO4ErJHbR4bz3947qOLwo9KkJ94af5 cwvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=O0oSnVrATzaOMgjgiEb3K+uP++mP+9RLcosRJsHZOo8=; b=LYOVK7ap0o1LCyCpNr1AjYXXwNKVhOZ780iV0Cxz0qIyoB1To/llqfA8Brp2S5kP4B 14gZvnPfIY3sdQX4CbGvLVxgVkujOVdCel/rOo5oWfu0TsfhOUVAxrUS6aD4YS92EyWJ bNIrkqswE2JUCfNS+zjixnRx/4H64ocbICjGxH71AJD15v3APIg+JW3Z0IqPv2pJLCyF K3Vk69ZJSYM2NHPRiYwPBwTz4UA4xp6KgW+6d/AMeH9Z/uVcVSJTbiIl4T12ssUM7nLC Nb55+SesfzEH+Kqvy6Y6nQ3KkqUlUqmc4WcPHAqD4wrnKnbm2JiXQWeM3452MzckBsuD lSqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1-v6si13370872ple.195.2018.10.16.01.54.46; Tue, 16 Oct 2018 01:57:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727297AbeJPQit (ORCPT + 99 others); Tue, 16 Oct 2018 12:38:49 -0400 Received: from outbound-smtp25.blacknight.com ([81.17.249.193]:44082 "EHLO outbound-smtp25.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726165AbeJPQit (ORCPT ); Tue, 16 Oct 2018 12:38:49 -0400 Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26]) by outbound-smtp25.blacknight.com (Postfix) with ESMTPS id A0BEDB87C8 for ; Tue, 16 Oct 2018 09:49:23 +0100 (IST) Received: (qmail 26529 invoked from network); 16 Oct 2018 08:49:25 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[37.228.229.142]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 16 Oct 2018 08:49:25 -0000 Date: Tue, 16 Oct 2018 09:49:23 +0100 From: Mel Gorman To: Andrew Morton Cc: Johannes Weiner , Rik van Riel , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 3/4] mm: workingset: add vmstat counter for shadow nodes Message-ID: <20181016084923.GH5819@techsingularity.net> References: <20181009184732.762-1-hannes@cmpxchg.org> <20181009184732.762-4-hannes@cmpxchg.org> <20181009150845.8656eb8ede045ca5f4cc4b21@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20181009150845.8656eb8ede045ca5f4cc4b21@linux-foundation.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 09, 2018 at 03:08:45PM -0700, Andrew Morton wrote: > On Tue, 9 Oct 2018 14:47:32 -0400 Johannes Weiner wrote: > > > --- a/mm/workingset.c > > +++ b/mm/workingset.c > > @@ -378,11 +378,17 @@ void workingset_update_node(struct xa_node *node) > > * as node->private_list is protected by the i_pages lock. > > */ > > if (node->count && node->count == node->nr_values) { > > - if (list_empty(&node->private_list)) > > + if (list_empty(&node->private_list)) { > > list_lru_add(&shadow_nodes, &node->private_list); > > + __inc_lruvec_page_state(virt_to_page(node), > > + WORKINGSET_NODES); > > + } > > } else { > > - if (!list_empty(&node->private_list)) > > + if (!list_empty(&node->private_list)) { > > list_lru_del(&shadow_nodes, &node->private_list); > > + __dec_lruvec_page_state(virt_to_page(node), > > + WORKINGSET_NODES); > > + } > > } > > } > > A bit worried that we're depending on the caller's caller to have > disabled interrupts to avoid subtle and rare errors. > > Can we do this? > > --- a/mm/workingset.c~mm-workingset-add-vmstat-counter-for-shadow-nodes-fix > +++ a/mm/workingset.c > @@ -377,6 +377,8 @@ void workingset_update_node(struct radix > * already where they should be. The list_empty() test is safe > * as node->private_list is protected by the i_pages lock. > */ > + WARN_ON_ONCE(!irqs_disabled()); /* For __inc_lruvec_page_state */ > + > if (node->count && node->count == node->exceptional) { > if (list_empty(&node->private_list)) { > list_lru_add(&shadow_nodes, &node->private_list); Note that for whatever reason, I've observed that irqs_disabled() is actually quite an expensive call. I'm not saying the warning is a bad idea but it should not be sprinkled around unnecessary and may be more suitable as a debug option. -- Mel Gorman SUSE Labs