From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EBB2C56201 for ; Fri, 30 Oct 2020 07:00:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 56D39206F4 for ; Fri, 30 Oct 2020 07:00:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="QbsL8H80" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 56D39206F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3B9196B005C; Fri, 30 Oct 2020 03:00:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 342286B005D; Fri, 30 Oct 2020 03:00:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 20A4F6B0062; Fri, 30 Oct 2020 03:00:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id E29196B005C for ; Fri, 30 Oct 2020 03:00:37 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 798118249980 for ; Fri, 30 Oct 2020 07:00:37 +0000 (UTC) X-FDA: 77427693714.12.brass96_520c78727294 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 4DC151801ACAB for ; Fri, 30 Oct 2020 07:00:37 +0000 (UTC) X-HE-Tag: brass96_520c78727294 X-Filterd-Recvd-Size: 5181 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Fri, 30 Oct 2020 07:00:36 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1604041235; 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: in-reply-to:in-reply-to:references:references; bh=RdT9jeZCqyX8v0LwKMHd85b9Jpujyxy38DhRa+Fnrho=; b=QbsL8H802RcvrFf/oxNm9QlCXZ+WtO6rDaFJcIZH2mDx6D94yVHXgMHo3BT9FLhvObRhXt Uv8N7oc0QxZqjlL04PMwEhVoaCCxFArw9unz9HVuoInS9LaUWNAB0KAgC+tocXy3q2DJnz zc380/Zm7LCGHe3NM07OdLutYSj4rxc= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 4DAC9AC0C; Fri, 30 Oct 2020 07:00:35 +0000 (UTC) Date: Fri, 30 Oct 2020 08:00:34 +0100 From: Michal Hocko To: Andrew Morton Cc: Nicholas Piggin , linux-mm@kvack.org, Maninder Singh , Vaneet Narang , Amit Sahrawat , Mel Gorman , Vlastimil Babka Subject: Re: [PATCH] mm/vmscan: Fix NR_ISOLATED_FILE corruption on 64-bit Message-ID: <20201030070034.GA1478@dhcp22.suse.cz> References: <20201029032320.1448441-1-npiggin@gmail.com> <20201029131103.GG17500@dhcp22.suse.cz> <20201029222526.a3c5157e5ad0a29a7e6ef883@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201029222526.a3c5157e5ad0a29a7e6ef883@linux-foundation.org> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu 29-10-20 22:25:26, Andrew Morton wrote: > On Thu, 29 Oct 2020 14:11:03 +0100 Michal Hocko wrote: > > > On Thu 29-10-20 13:23:20, Nicholas Piggin wrote: > > > 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)))". > > > > Nasty. > > > > > Cc: linux-mm@kvack.org > > > Cc: Maninder Singh > > > Cc: Vaneet Narang > > > Cc: Maninder Singh > > > Cc: Michal Hocko > > > Cc: Amit Sahrawat > > > Cc: Mel Gorman > > > Cc: Vlastimil Babka > > > Fixes: 730ec8c01a2b ("mm/vmscan.c: change prototype for shrink_page_list") > > > Signed-off-by: Nicholas Piggin > > > --- > > > mm/vmscan.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/mm/vmscan.c b/mm/vmscan.c > > > index 1b8f0e059767..92c507bacf09 100644 > > > --- a/mm/vmscan.c > > > +++ b/mm/vmscan.c > > > @@ -1516,7 +1516,7 @@ unsigned int reclaim_clean_pages_from_list(struct zone *zone, > > > 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 > > > > You want the same also for -stat.nr_lazyfree_fail right? > > I did the below, and added a cc:stable. > > --- a/mm/vmscan.c~mm-vmscan-fix-nr_isolated_file-corruption-on-64-bit-fix > +++ a/mm/vmscan.c > @@ -1516,7 +1516,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, -(long)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 > @@ -1526,7 +1527,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; > } Acked-by: Michal Hocko Btw. regular reclaim paths are OK because nr_taken is unsigned long. Btw #2 I was quite surprised about the inconsistency for !SMP case where __mod_node_page_state uses int for the delta. Thanks! -- Michal Hocko SUSE Labs