Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3867694pxb; Tue, 17 Nov 2020 05:47:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQOeuPLU7L5H3ML4vkQ4c7QoZZu2eqev4Pqy8jP683/F8Tk8eE41Khol79IyGRwgKQ5ID4 X-Received: by 2002:aa7:db48:: with SMTP id n8mr21531600edt.123.1605620835635; Tue, 17 Nov 2020 05:47:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620835; cv=none; d=google.com; s=arc-20160816; b=UYuP8FcSFbn0I46L6Zc1K4BbtOp1B69yMLrjdxt4kGsjoEAyyQW05PyH2Uynpk/3Xy KTLNpq+u5R/uoQgk0kcXLnweHGxiEs87y1r+/bmwY6F6khhZ2vARpfopnTJ1J0rPKnFH jtFd3WTwQFSeBYr1MuHCyaMGhfSYBMRHDvtjaX7U8kJhl67CTxqM0wZ21QJ/X//JnC/h iHyCbyNesfX0zGIGNzmF5d0LLhsyq7pr0K0ymUXF4rBxHdHs4hs43Th7RCXM09gUf5GJ F5aLSlIM25AXoHG0PsEHOcJV6b7orJSzomExujFg0RW5gJvZoFZ4ZaHVbjDpW400gnsv mS7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vdfmr8RibuChwBge7oN3HCmrIrEFekI4Gj2Tlc9QB0I=; b=0whlawmYRfBnmVTvTUUx9xe48GFJ/iDr0oZAIEC4kZzG+ScjCmi4Vaz8LfPFjluT5v sh+O5t7FKddUH+mRtWdzX/a5FW7twsucDNehuTzQUo5l8VrBSGYo3Qdmk45U0m/6rhXW jXiVfedBDW7nLDAHjRt2f7Bh+xEb1HZyWVjY0WCtr7Z+2j3TItqwGi1MNycTPTN+ZPS3 q5D/sS3+C16CYPdKgDGXJPsWUqEtOFBzbw2Pq58c/F/kgSeKhhGZbMuupLhy9Ti5ML8E yvXIT54IIX26pCBrk86J9IYthJH5i2XQLaYmGoFMhCjUwCPAPTBZa/qgwqO9Mwv+D9dy /m4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QwwOusEm; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id co2si694326edb.217.2020.11.17.05.46.52; Tue, 17 Nov 2020 05:47:15 -0800 (PST) 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=@kernel.org header.s=default header.b=QwwOusEm; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732864AbgKQNoh (ORCPT + 99 others); Tue, 17 Nov 2020 08:44:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:52354 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732850AbgKQNkU (ORCPT ); Tue, 17 Nov 2020 08:40:20 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 30EBE2467A; Tue, 17 Nov 2020 13:40:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605620419; bh=yJzKDwnp94Q/L/qdDqO8mmVFGg1PNfnZcPHUCBIo92g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QwwOusEmiODXIGjc5SVAy6KpV5lX9f5SO0DY5U7rWJDN7I9LTFFXlnN7qlxdCzj5+ EnXBwemPgZ736fXxHIWJ9bDd/xwTI+ZNBhXeEtyC2+CkY7L51UtCPKbYO27T5JpEcG p3lqbKC+i8u8+4bYCGIU8nnh2SGgfPvDBqRg1RnI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Andrew Morton , Michal Hocko , Vaneet Narang , Maninder Singh , Amit Sahrawat , Mel Gorman , Vlastimil Babka , Linus Torvalds Subject: [PATCH 5.9 212/255] mm/vmscan: fix NR_ISOLATED_FILE corruption on 64-bit Date: Tue, 17 Nov 2020 14:05:52 +0100 Message-Id: <20201117122149.253216909@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nicholas Piggin commit 2da9f6305f306ffbbb44790675799328fb73119d upstream. Previously the negated unsigned long would be cast back to signed long which would have the correct negative value. After commit 730ec8c01a2b ("mm/vmscan.c: change prototype for shrink_page_list"), the large unsigned int converts to a large positive signed long. Symptoms include CMA allocations hanging forever holding the cma_mutex due to alloc_contig_range->...->isolate_migratepages_block waiting forever in "while (unlikely(too_many_isolated(pgdat)))". [akpm@linux-foundation.org: fix -stat.nr_lazyfree_fail as well, per Michal] Fixes: 730ec8c01a2b ("mm/vmscan.c: change prototype for shrink_page_list") Signed-off-by: Nicholas Piggin Signed-off-by: Andrew Morton Acked-by: Michal Hocko Cc: Vaneet Narang Cc: Maninder Singh Cc: Amit Sahrawat Cc: Mel Gorman Cc: Vlastimil Babka Cc: Link: https://lkml.kernel.org/r/20201029032320.1448441-1-npiggin@gmail.com Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/vmscan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1514,7 +1514,8 @@ unsigned int reclaim_clean_pages_from_li nr_reclaimed = shrink_page_list(&clean_pages, zone->zone_pgdat, &sc, TTU_IGNORE_ACCESS, &stat, true); list_splice(&clean_pages, page_list); - mod_node_page_state(zone->zone_pgdat, NR_ISOLATED_FILE, -nr_reclaimed); + mod_node_page_state(zone->zone_pgdat, NR_ISOLATED_FILE, + -(long)nr_reclaimed); /* * Since lazyfree pages are isolated from file LRU from the beginning, * they will rotate back to anonymous LRU in the end if it failed to @@ -1524,7 +1525,7 @@ unsigned int reclaim_clean_pages_from_li mod_node_page_state(zone->zone_pgdat, NR_ISOLATED_ANON, stat.nr_lazyfree_fail); mod_node_page_state(zone->zone_pgdat, NR_ISOLATED_FILE, - -stat.nr_lazyfree_fail); + -(long)stat.nr_lazyfree_fail); return nr_reclaimed; }