From patchwork Thu Jul 29 21:53:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12409923 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 DF396C4320A for ; Thu, 29 Jul 2021 21:53:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9293160F4B for ; Thu, 29 Jul 2021 21:53:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9293160F4B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 365BF6B0072; Thu, 29 Jul 2021 17:53:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3160B6B0073; Thu, 29 Jul 2021 17:53:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2054A8D0001; Thu, 29 Jul 2021 17:53:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0055.hostedemail.com [216.40.44.55]) by kanga.kvack.org (Postfix) with ESMTP id 05C6D6B0072 for ; Thu, 29 Jul 2021 17:53:50 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 9F3808249980 for ; Thu, 29 Jul 2021 21:53:49 +0000 (UTC) X-FDA: 78416978178.38.1B002E2 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf07.hostedemail.com (Postfix) with ESMTP id 4C1451000F59 for ; Thu, 29 Jul 2021 21:53:49 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 2F37260F5C; Thu, 29 Jul 2021 21:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1627595628; bh=0CPZlj+fWC8wwVbGpQ/ZrTe4EeZiizNkZCuDLtS81h8=; h=Date:From:To:Subject:In-Reply-To:From; b=b4M0UzVWksn4kyIw0Cb4NewKZmLyixKG0CDu/gkzLB+DnWYKahTCHt8wlXLI4OLEG nce1VYurhzJJJwJd2UKrQB0Ioahjl/s2b2Niqu00TaxFHZfUbNz4scB2M+uL5fLhfu ZeEwjvbjcwy0SwUAVbFDbKsNo4uLXzb8ou0e/7l8= Date: Thu, 29 Jul 2021 14:53:47 -0700 From: Andrew Morton To: aik@ozlabs.ru, akpm@linux-foundation.org, aneesh.kumar@linux.ibm.com, david@redhat.com, linux-mm@kvack.org, mgorman@suse.de, mm-commits@vger.kernel.org, mpe@ellerman.id.au, npiggin@gmail.com, shy828301@gmail.com, torvalds@linux-foundation.org Subject: [patch 5/7] mm/migrate: fix NR_ISOLATED corruption on 64-bit Message-ID: <20210729215347.QTp5MNe-m%akpm@linux-foundation.org> In-Reply-To: <20210729145259.24681c326dc3ed18194cf9e5@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 4C1451000F59 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=b4M0UzVW; spf=pass (imf07.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Stat-Signature: 6mynsqahpzp4aq41wbcbboe9py33of49 X-HE-Tag: 1627595629-21069 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: From: "Aneesh Kumar K.V" Subject: mm/migrate: fix NR_ISOLATED corruption on 64-bit Similar to commit 2da9f6305f30 ("mm/vmscan: fix NR_ISOLATED_FILE corruption on 64-bit") avoid using unsigned int for nr_pages. With unsigned int type the large unsigned int converts to a large positive signed long. Symptoms include CMA allocations hanging forever due to alloc_contig_range->...->isolate_migratepages_block waiting forever in "while (unlikely(too_many_isolated(pgdat)))". Link: https://lkml.kernel.org/r/20210728042531.359409-1-aneesh.kumar@linux.ibm.com Fixes: c5fc5c3ae0c8 ("mm: migrate: account THP NUMA migration counters correctly") Signed-off-by: Aneesh Kumar K.V Reported-by: Michael Ellerman Reported-by: Alexey Kardashevskiy Reviewed-by: Yang Shi Cc: Mel Gorman Cc: Nicholas Piggin Cc: David Hildenbrand Signed-off-by: Andrew Morton --- mm/migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/migrate.c~mm-migrate-fix-nr_isolated-corruption-on-64-bit +++ a/mm/migrate.c @@ -2068,7 +2068,7 @@ int migrate_misplaced_page(struct page * LIST_HEAD(migratepages); new_page_t *new; bool compound; - unsigned int nr_pages = thp_nr_pages(page); + int nr_pages = thp_nr_pages(page); /* * PTE mapped THP or HugeTLB page can't reach here so the page could