Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4074166ybz; Mon, 20 Apr 2020 15:13:10 -0700 (PDT) X-Google-Smtp-Source: APiQypIrbn61ET5Mp7diBh3K1irpPMA0aBwshfjQJHLA8CdLfW9pbooyA4ooRLa66kZuzBpXH+be X-Received: by 2002:a17:906:7d7:: with SMTP id m23mr17493651ejc.154.1587420790083; Mon, 20 Apr 2020 15:13:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587420790; cv=none; d=google.com; s=arc-20160816; b=V3UnsnDpoz0GS5R6+U9LLwqQpBJ3vE7LFzvZmD4e1oo1nlQCk5+wB/CkFQERMHRK3Q ByLVN9NHOxw8gErE5Ciq2E3T18eX3xfOa63kYMXoHFIpSBTt2DlyzTG9X/kWVANnBQ5u l1+WEDKDwQZrr6tbKRQWxAqNRhqUSiHxpt2uzU5hHCmvr3HN3Q+A8WXAZRdBoOrbycfq Gf7+6KBIeVvyCyX4KXByqt+anpHIvZHUorVeto1oh5aNQ1RTx8X48gl+gqVeVHMfURhC dadtp9TLxvA+JkTUZZP1ycJnh1zeydCqSw3/zhSnA2mESvrinwqRHYHwYlzIUovjLNuy RO1A== 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:date:subject:cc:to:from :dkim-signature; bh=n0En7iea1xuMHdBkCdJ+zycx29vIdm+FB4ZhZph/8RA=; b=N56jN/SGgluty4/Bo9tbtQtu01sYHdHnxg9yIxiRpn5AmdbCqrtc8UASsNoq/3NaBU bPoKq2saADowZ8+JyQYzawSxRswASZrkJUT9oGw+vFTTKn0nAb9Yrunm3hO18slt6Zxy ohqkWhhaovOS2H4e4P+iciXnSs4irENzk/yQIcNOlK3B/49x/zS9PspEuGUwgg3c/rab fxX72TlmgKIvIrstbOcudW//TlVPLWn+ZC9pPMDZ2pjQHwgp9uvHcKy+op6hHKWweE4f uvbua/LnM53sHRGBzigV3l383ZKWmXSpYmsKdwgwPaSlbQF26OchD489rg8qolQlv9wb yEXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=ytVzBYSd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z12si536969edp.162.2020.04.20.15.12.45; Mon, 20 Apr 2020 15:13:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=ytVzBYSd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727822AbgDTWLo (ORCPT + 99 others); Mon, 20 Apr 2020 18:11:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725774AbgDTWLm (ORCPT ); Mon, 20 Apr 2020 18:11:42 -0400 Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47103C061A0C for ; Mon, 20 Apr 2020 15:11:41 -0700 (PDT) Received: by mail-qt1-x841.google.com with SMTP id r19so105506qtu.11 for ; Mon, 20 Apr 2020 15:11:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n0En7iea1xuMHdBkCdJ+zycx29vIdm+FB4ZhZph/8RA=; b=ytVzBYSdrTwoP1lGYSOvOioRHuNpY59hcJqq6rdmPp/5WO7TBcNl+19HabZo6xw4Rn qLw3rumZnC1nnA9CsqRYaFeBEQD6N7IHV688IAD/9h72nTicP9Z+17XYXG5QVZCsrAFM ACZguEsWBuUoSAgQM3X5NiaJFIpG+c+2GUyyd7eyG+fx1d+7jgnDJrGO0cezEkC0xZvM 8nV42K2p735E7d91FlpY76Qo2jRCyJQLC/ai+GQ8n01nlL5u7xhMbp3N1ZagriVA9qSs aWd/SqscVR7WQIhKv6hgAz1fo5DFtX84tROp4i33h+wmrEm2cTskKSZqtiIbyvR4mzAe sGvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n0En7iea1xuMHdBkCdJ+zycx29vIdm+FB4ZhZph/8RA=; b=hJ5WHj5vD2mN3mGEz+T8girKZm5m13BYK0Nye3I0IVwb7c+l6xxwg0uKjkPh6I6Wrg ZanxX+2kGaeefS8X7gWrWhdYHkcEIqBD0aa2PT/BGJg/xcwwCVVc6S2bnxE3B2OggAa9 VzZa1BvY1nPHz6s3xH1mbERxYyJWvMP71ixS4vlMKacJqwwhSCz0P0IMbhsetz+WLTry EY1lWC2cS0n5MCYWkOFlpiuqNkqoIRmwbM1Z39cobIoF0g6n3ZDVEtvCDTmG3yOTLEvi mM9YFlGICAUT7R5wuvYDiUivLJHWMcnlUIPayxqtPrKMHFMi/hALkOPVCv+TaBfPEut1 ibnw== X-Gm-Message-State: AGi0PuZjOJlXqaxDS1yDscL83MVR9EGlwBc625Vgjmq5uLmS8XiK9j+O 4oMbHdQQXuYq2GqYXzkoB5mz4g== X-Received: by 2002:ac8:22ad:: with SMTP id f42mr18138503qta.292.1587420700560; Mon, 20 Apr 2020 15:11:40 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:e6b6]) by smtp.gmail.com with ESMTPSA id c23sm605354qka.12.2020.04.20.15.11.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2020 15:11:39 -0700 (PDT) From: Johannes Weiner To: Joonsoo Kim , Alex Shi Cc: Shakeel Butt , Hugh Dickins , Michal Hocko , "Kirill A. Shutemov" , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 01/18] mm: fix NUMA node file count error in replace_page_cache() Date: Mon, 20 Apr 2020 18:11:09 -0400 Message-Id: <20200420221126.341272-2-hannes@cmpxchg.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200420221126.341272-1-hannes@cmpxchg.org> References: <20200420221126.341272-1-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When replacing one page with another one in the cache, we have to decrease the file count of the old page's NUMA node and increase the one of the new NUMA node, otherwise the old node leaks the count and the new node eventually underflows its counter. Fixes: 74d609585d8b ("page cache: Add and replace pages using the XArray") Signed-off-by: Johannes Weiner --- mm/filemap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 23a051a7ef0f..49e3b5da0216 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -808,11 +808,11 @@ int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask) old->mapping = NULL; /* hugetlb pages do not participate in page cache accounting. */ if (!PageHuge(old)) - __dec_node_page_state(new, NR_FILE_PAGES); + __dec_node_page_state(old, NR_FILE_PAGES); if (!PageHuge(new)) __inc_node_page_state(new, NR_FILE_PAGES); if (PageSwapBacked(old)) - __dec_node_page_state(new, NR_SHMEM); + __dec_node_page_state(old, NR_SHMEM); if (PageSwapBacked(new)) __inc_node_page_state(new, NR_SHMEM); xas_unlock_irqrestore(&xas, flags); -- 2.26.0