Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp133478imm; Tue, 9 Oct 2018 15:10:14 -0700 (PDT) X-Google-Smtp-Source: ACcGV620/aoXlo1AOgCdKw3AIQJGjZmmDxASmHuZ4tw7N5SDQ8sH/jpg0g1T1Do2i8Yu0BcfSRDd X-Received: by 2002:a17:902:968d:: with SMTP id n13-v6mr30312149plp.33.1539123014764; Tue, 09 Oct 2018 15:10:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539123014; cv=none; d=google.com; s=arc-20160816; b=oXI043e/yg1RurahxnnymBAn468SuLOIem+i7YDSET2dnZzzY7GbpZKybRtkmZqAs+ xH/ImzwgMuL7605sEMAarawALYXm5N3hSnoZm1mTaGuYlNb+IQ15iy4p4F3sn9R+u9Sw YghBBNDC1+b222ff6uOseJnWeylp9V/Jv2NedrbnZxjBR4c4Sc4uwvymz+hZnFzLMbo1 7TSzjNreYwOXsY7lCtHyEj9o/Imz7JmVkVcrjvjCLVbPP9VT3b4lLT0sk7cKExwYE2zB Csy2plMhpIRVHluTDZdWTFdnTgTTbJo026sq/r1De4SM+8vvbxMwee1tZLni38aJ05/e bfLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=IUOdl7cpaCvwFpAOzKCnn+VVlAMG89ICwBUneFQ7ryo=; b=F1nD+YfTt8zaZjXnqNF3opr2AhqAussUfN1vOSOPCoD0+uI2V0s9ZaQbZyL1LkKZ5K pE5Nym/gc18DmvdrZAgXi/iyubIw2M6b75m2wtkDCAIYC3x9GcuCZxPCv4+2rLJfLlNr ohf9eIMcEOrHUAeULWVXDapaBLb2MF2mv6dBI0GW7ovHrdEnnkDnrfTKzCUfrZ9QVR7e fuFTO0UP08cER2kmQWUHQ1GR0xmZoFo6w2ymXnLoSSDAumU9+im82ao/AHRvGUr9Bq2n 8SHGsPuHQB9oqL8Vdwg+6NUvraMQkb9P0+n+dJjkv+Iu0EvkskTgUlHErgt07ucA1wRI 7dhQ== 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 m15-v6si21835182pga.114.2018.10.09.15.09.59; Tue, 09 Oct 2018 15:10:14 -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 S1728000AbeJJF1t (ORCPT + 99 others); Wed, 10 Oct 2018 01:27:49 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57636 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726781AbeJJF1t (ORCPT ); Wed, 10 Oct 2018 01:27:49 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.8.65]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B3E75A85; Tue, 9 Oct 2018 22:08:46 +0000 (UTC) Date: Tue, 9 Oct 2018 15:08:45 -0700 From: Andrew Morton To: Johannes Weiner Cc: 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: <20181009150845.8656eb8ede045ca5f4cc4b21@linux-foundation.org> In-Reply-To: <20181009184732.762-4-hannes@cmpxchg.org> References: <20181009184732.762-1-hannes@cmpxchg.org> <20181009184732.762-4-hannes@cmpxchg.org> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); _