From patchwork Mon Nov 13 23:34:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 164686 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1544717vqg; Mon, 13 Nov 2023 15:46:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IEoLfJaDN3SwA/lJJvHkaKqwBr/CWosQKGtkEcYYtQfQTrG9Wmm/6Dy/s5rxM7ytl6t3+41 X-Received: by 2002:a05:6808:1211:b0:3ab:8e86:fc26 with SMTP id a17-20020a056808121100b003ab8e86fc26mr12776488oil.46.1699919168200; Mon, 13 Nov 2023 15:46:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699919168; cv=none; d=google.com; s=arc-20160816; b=GgJMAIEq12RcUT0JURvG4WZZyfJ8VTGv4U3QLdGDLlXDrfl2iJNVfGeKDJ09+LRlxg Jhk3HJQLJXohjQjg/pg1Qqbe0fVaTPiuAUoJCurp3MmKth+7213zkbl9sEqCbuteMrJE 9k73ufJIxQUK6SDQxcYr2pGi7FdcPqfc8Kp4adco/mM/4HJE/vmaqMYP2Pm6gu+UVh8y Doh+VyxgUZKFl5E23EP0M9r8syXFlKGVDA90X1MbnaEz2Su9vI2wilut1aaD6JblPOnB 9O6nqL5JpGb6pmK+SijJneYivE/7i5R+qH83U4VXbOcrhzcRDyKECjU4gSmQLj4c0n7X WRVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=MWLskBwSdWDZ41yFDXxOzxCovYMtUiIkublLbv2soJQ=; fh=ZLVD6vHOrhDQgDHBuQrFnisZQmJoj22R6A6QxDzMNVg=; b=WkCvSCZePZmXKh3VFSaxLjuQK2+0Dy1NNQwjaD63qHL/KNAcSR+RjCqen6QPXA6QXt TYdpoluiax2YAQPYCWCO34aSQ2QnT6jFpe+xfE6ZIHv/AFM7SEzpqECUwO0Y05Zicsi8 8vyaxKFk32mem3tlVrdXqvMNf2Xwnjij2unZt99SVB5BU43KuwaDy0NOFwE4tIbQTot8 MyU0PgCYKIykDAsVof44ATMy1BXObRmRndruI37Qw2Cqpc65dVk3MYNcaNm6BbI0HkNE YazJNgKQeaU/9heOhrICwLxKZx6QRat0xnjH8JAJ17OvRWmVNAuBpHB549C1Uj31u+3T 52DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gY2+4zPD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id k186-20020a6384c3000000b00578b37ad24bsi6379838pgd.619.2023.11.13.15.46.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 15:46:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gY2+4zPD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id F1D1C8057D9A; Mon, 13 Nov 2023 15:45:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229696AbjKMXpU (ORCPT + 30 others); Mon, 13 Nov 2023 18:45:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231370AbjKMXpQ (ORCPT ); Mon, 13 Nov 2023 18:45:16 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5C258F for ; Mon, 13 Nov 2023 15:44:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699919088; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=MWLskBwSdWDZ41yFDXxOzxCovYMtUiIkublLbv2soJQ=; b=gY2+4zPDrtW6sgBm9w9yN1Kn08GlMkvW+YDfo59mwxrmXIsCpSlccM6/qHaukSNNnEovkY 7Y3S3nQXHuIXIxSek4FqLHPFUU87zStHR9ZCNf+7NBfiRaVm+P/7tN+ZvW4lHYIBoMJep6 Q+dVUw5qCj5DMgiiec0RMA1lmYlQJ04= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-154-HezSOEpmMgCumBzIQGPfFQ-1; Mon, 13 Nov 2023 18:44:44 -0500 X-MC-Unique: HezSOEpmMgCumBzIQGPfFQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1261C810FC0; Mon, 13 Nov 2023 23:44:42 +0000 (UTC) Received: from tpad.localdomain (ovpn-112-2.gru2.redhat.com [10.97.112.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CC5882166B26; Mon, 13 Nov 2023 23:44:41 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id 2C3E9409B6035; Mon, 13 Nov 2023 20:35:57 -0300 (-03) Message-ID: <20231113233502.563575851@redhat.com> User-Agent: quilt/0.67 Date: Mon, 13 Nov 2023 20:34:21 -0300 From: Marcelo Tosatti To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Michal Hocko , Vlastimil Babka , Andrew Morton , David Hildenbrand , Peter Xu , Marcelo Tosatti Subject: [patch 1/2] mm: vmstat: introduce node_page_state_pages_snapshot References: <20231113233420.446465795@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 13 Nov 2023 15:45:48 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782494441663533716 X-GMAIL-MSGID: 1782494441663533716 Introduce a _snapshot variant of node_page_state_snapshot, similar to zone_page_state_snapshot. To be used by next patch. Signed-off-by: Marcelo Tosatti --- include/linux/vmstat.h | 4 ++++ mm/vmstat.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) Index: linux/mm/vmstat.c =================================================================== --- linux.orig/mm/vmstat.c +++ linux/mm/vmstat.c @@ -1031,6 +1031,34 @@ unsigned long node_page_state(struct pgl return node_page_state_pages(pgdat, item); } + +/* + * Determine the per node value of a stat item, snapshot version + * (see comment on top zone_page_state_snapshot). + */ +unsigned long node_page_state_pages_snapshot(struct pglist_data *pgdat, + enum node_stat_item item) +{ + long x = atomic_long_read(&pgdat->vm_stat[item]); +#ifdef CONFIG_SMP + int cpu; + + for_each_online_cpu(cpu) + x += per_cpu_ptr(pgdat->per_cpu_nodestats, cpu)->vm_node_stat_diff[item]; + + if (x < 0) + x = 0; +#endif + return x; +} + +unsigned long node_page_state_snapshot(struct pglist_data *pgdat, + enum node_stat_item item) +{ + VM_WARN_ON_ONCE(vmstat_item_in_bytes(item)); + + return node_page_state_pages(pgdat, item); +} #endif #ifdef CONFIG_COMPACTION Index: linux/include/linux/vmstat.h =================================================================== --- linux.orig/include/linux/vmstat.h +++ linux/include/linux/vmstat.h @@ -262,6 +262,10 @@ extern unsigned long node_page_state(str enum node_stat_item item); extern unsigned long node_page_state_pages(struct pglist_data *pgdat, enum node_stat_item item); +extern unsigned long node_page_state_snapshot(struct pglist_data *pgdat, + enum node_stat_item item); +extern unsigned long node_page_state_pages_snapshot(struct pglist_data *pgdat, + enum node_stat_item item); extern void fold_vm_numa_events(void); #else #define sum_zone_node_page_state(node, item) global_zone_page_state(item) From patchwork Mon Nov 13 23:34:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 164685 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1544664vqg; Mon, 13 Nov 2023 15:46:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IETJtOc39b7mMOTzQWNY2uvl2jSk07Mw/j42Cc0lrhd2DX8VaafnFK4Ueubbj/Q8ZSOMrzs X-Received: by 2002:a17:902:8691:b0:1cc:b09a:b811 with SMTP id g17-20020a170902869100b001ccb09ab811mr591786plo.14.1699919160263; Mon, 13 Nov 2023 15:46:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699919160; cv=none; d=google.com; s=arc-20160816; b=BzAjt04zLrlaLxcwH9CeZCRu2vmcEoIhyF47RDvQGQZ7i5PKBkb7pe4Fw19OlazNIh qidfBWrwZgwFNR3H/QUA42cIlw9zrFT8o+T0rL39dvYrIA5GKYUuGHMQQy5fES5HreSV bAsd3dLNxVwfLmnR+KxVcmprFq09monKfDltt29+XagNniZvALMKsHTorY5jH+kEksN5 aLN0FjFU7vo/NwX8YSY4QdWnDHTc8E+IJUl5a7jCjviFODrT+mANEpTg/esjL1aPfy2z 2rcMO10rgwWoGUfCzjQkHZMn0hMBz7Y+l/v65+jXFJ3tXa93tWd/B0uNUYgHUYcz9Xl5 UtHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id:dkim-signature; bh=kzmqPw87QEnBeQlSVWGP3J/i9psO+2r7MY9OYmaqENY=; fh=ZLVD6vHOrhDQgDHBuQrFnisZQmJoj22R6A6QxDzMNVg=; b=G6XgLFcbsWD0GEAKaz+pWQOQnvMJ/D//f323Eb+Z+Fy1k3c/YOfcbbPPvR/gwhIhZ1 gvf2gpqcEk5dTFk5grUe7+sl2lIxSS3D00h76HsTNzA8LwZNsdzvDD0cLdkCAR8ql8bL YVl4T8tMsdufuuR6fdHQ5FDMk2jvXB8KEC/S4peqtnrnQW1NK7V48UCEzzcHh70mW2po 9nR3Am8mVbIdzdtSNGGTx/sChmPoSOxlGW7g+jr+IARD9o5SJeblwH4Bweh0fwQwmanN 55Z3aQ+QeptlzPfRMpLSOqEPg95kbZ41qp/E0ylIb7k+uNoUSWmJlRKLaQihbiDp+kFf RWxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SFEhJbx2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id y5-20020a17090322c500b001cc692bf120si6951980plg.61.2023.11.13.15.45.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 15:46:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SFEhJbx2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 7F97E8080033; Mon, 13 Nov 2023 15:45:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231912AbjKMXpR (ORCPT + 30 others); Mon, 13 Nov 2023 18:45:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229696AbjKMXpO (ORCPT ); Mon, 13 Nov 2023 18:45:14 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D042910C for ; Mon, 13 Nov 2023 15:44:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699919086; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=kzmqPw87QEnBeQlSVWGP3J/i9psO+2r7MY9OYmaqENY=; b=SFEhJbx2P30DtkyJtAeGImnme/Tc6+QiEWWLyv1JxBGOUaMIJaY/fbsU+xwPjOdq3yAEjc +duoKUPoZTFGEFiJjFyqnE4xPiOL0hzP1bm2mIyoqCgT6D3Q7RrpuWBFrAsBg1YwVLuu7E qHvVtrwDUnpvhpNInUqKk85thQVvVwA= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-649-cZCqJAktN82N8Llx0r_7qg-1; Mon, 13 Nov 2023 18:44:43 -0500 X-MC-Unique: cZCqJAktN82N8Llx0r_7qg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3CA341C2B660; Mon, 13 Nov 2023 23:44:42 +0000 (UTC) Received: from tpad.localdomain (ovpn-112-2.gru2.redhat.com [10.97.112.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CCD5F40C6EB9; Mon, 13 Nov 2023 23:44:41 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id 300E6409C16E0; Mon, 13 Nov 2023 20:35:57 -0300 (-03) Message-ID: <20231113233502.587879658@redhat.com> User-Agent: quilt/0.67 Date: Mon, 13 Nov 2023 20:34:22 -0300 From: Marcelo Tosatti To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Michal Hocko , Vlastimil Babka , Andrew Morton , David Hildenbrand , Peter Xu , Marcelo Tosatti Subject: [patch 2/2] mm: vmstat: use node_page_state_snapshot in too_many_isolated References: <20231113233420.446465795@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 13 Nov 2023 15:45:57 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782494433096626652 X-GMAIL-MSGID: 1782494433096626652 A customer reported seeing processes hung at too_many_isolated, while analysis indicated that the problem occurred due to out of sync per-CPU stats (see below). Fix is to use node_page_state_snapshot to avoid the out of stale values. 2136 static unsigned long 2137 shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec, 2138 struct scan_control *sc, enum lru_list lru) 2139 { : 2145 bool file = is_file_lru(lru); : 2147 struct pglist_data *pgdat = lruvec_pgdat(lruvec); : 2150 while (unlikely(too_many_isolated(pgdat, file, sc))) { 2151 if (stalled) 2152 return 0; 2153 2154 /* wait a bit for the reclaimer. */ 2155 msleep(100); <--- some processes were sleeping here, with pending SIGKILL. 2156 stalled = true; 2157 2158 /* We are about to die and free our memory. Return now. */ 2159 if (fatal_signal_pending(current)) 2160 return SWAP_CLUSTER_MAX; 2161 } msleep() must be called only when there are too many isolated pages: 2019 static int too_many_isolated(struct pglist_data *pgdat, int file, 2020 struct scan_control *sc) 2021 { : 2030 if (file) { 2031 inactive = node_page_state(pgdat, NR_INACTIVE_FILE); 2032 isolated = node_page_state(pgdat, NR_ISOLATED_FILE); 2033 } else { : 2046 return isolated > inactive; The return value was true since: crash> p ((struct pglist_data *) 0xffff00817fffe580)->vm_stat[NR_INACTIVE_FILE] $8 = { counter = 1 } crash> p ((struct pglist_data *) 0xffff00817fffe580)->vm_stat[NR_ISOLATED_FILE] $9 = { counter = 2 while per_cpu stats had: crash> p ((struct pglist_data *) 0xffff00817fffe580)->per_cpu_nodestats $85 = (struct per_cpu_nodestat *) 0xffff8000118832e0 crash> p/x 0xffff8000118832e0 + __per_cpu_offset[42] $86 = 0xffff00917fcc32e0 crash> p ((struct per_cpu_nodestat *) 0xffff00917fcc32e0)->vm_node_stat_diff[NR_ISOLATED_FILE] $87 = -1 '\377' crash> p/x 0xffff8000118832e0 + __per_cpu_offset[44] $89 = 0xffff00917fe032e0 crash> p ((struct per_cpu_nodestat *) 0xffff00917fe032e0)->vm_node_stat_diff[NR_ISOLATED_FILE] $91 = -1 '\377' It seems that processes were trapped in direct reclaim/compaction loop because these nodes had few free pages lower than watermark min. crash> kmem -z | grep -A 3 Normal : NODE: 4 ZONE: 1 ADDR: ffff00817fffec40 NAME: "Normal" SIZE: 8454144 PRESENT: 98304 MIN/LOW/HIGH: 68/166/264 VM_STAT: NR_FREE_PAGES: 68 -- NODE: 5 ZONE: 1 ADDR: ffff00897fffec40 NAME: "Normal" SIZE: 118784 MIN/LOW/HIGH: 82/200/318 VM_STAT: NR_FREE_PAGES: 45 -- NODE: 6 ZONE: 1 ADDR: ffff00917fffec40 NAME: "Normal" SIZE: 118784 MIN/LOW/HIGH: 82/200/318 VM_STAT: NR_FREE_PAGES: 53 -- NODE: 7 ZONE: 1 ADDR: ffff00997fbbec40 NAME: "Normal" SIZE: 118784 MIN/LOW/HIGH: 82/200/318 VM_STAT: NR_FREE_PAGES: 52 Signed-off-by: Marcelo Tosatti --- mm/compaction.c | 6 +++--- mm/vmscan.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) Index: linux/mm/compaction.c =================================================================== --- linux.orig/mm/compaction.c +++ linux/mm/compaction.c @@ -791,11 +791,11 @@ static bool too_many_isolated(struct com unsigned long active, inactive, isolated; - inactive = node_page_state(pgdat, NR_INACTIVE_FILE) + + inactive = node_page_state_snapshot(pgdat, NR_INACTIVE_FILE) + node_page_state(pgdat, NR_INACTIVE_ANON); - active = node_page_state(pgdat, NR_ACTIVE_FILE) + + active = node_page_state_snapshot(pgdat, NR_ACTIVE_FILE) + node_page_state(pgdat, NR_ACTIVE_ANON); - isolated = node_page_state(pgdat, NR_ISOLATED_FILE) + + isolated = node_page_state_snapshot(pgdat, NR_ISOLATED_FILE) + node_page_state(pgdat, NR_ISOLATED_ANON); /* Index: linux/mm/vmscan.c =================================================================== --- linux.orig/mm/vmscan.c +++ linux/mm/vmscan.c @@ -1756,11 +1756,11 @@ static int too_many_isolated(struct pgli return 0; if (file) { - inactive = node_page_state(pgdat, NR_INACTIVE_FILE); - isolated = node_page_state(pgdat, NR_ISOLATED_FILE); + inactive = node_page_state_snapshot(pgdat, NR_INACTIVE_FILE); + isolated = node_page_state_snapshot(pgdat, NR_ISOLATED_FILE); } else { - inactive = node_page_state(pgdat, NR_INACTIVE_ANON); - isolated = node_page_state(pgdat, NR_ISOLATED_ANON); + inactive = node_page_state_snapshot(pgdat, NR_INACTIVE_ANON); + isolated = node_page_state_snapshot(pgdat, NR_ISOLATED_ANON); } /*