From patchwork Wed Jul 28 04:25:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 12405001 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=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 63CBEC4338F for ; Wed, 28 Jul 2021 04:26:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A75B260C3F for ; Wed, 28 Jul 2021 04:26:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A75B260C3F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 46A046B0036; Wed, 28 Jul 2021 00:26:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 41A636B005D; Wed, 28 Jul 2021 00:26:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 308778D0001; Wed, 28 Jul 2021 00:26:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0155.hostedemail.com [216.40.44.155]) by kanga.kvack.org (Postfix) with ESMTP id 1555A6B0036 for ; Wed, 28 Jul 2021 00:26:05 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A9067180AD815 for ; Wed, 28 Jul 2021 04:26:04 +0000 (UTC) X-FDA: 78410709048.40.D93F0F4 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by imf01.hostedemail.com (Postfix) with ESMTP id 18ECA50210D1 for ; Wed, 28 Jul 2021 04:26:03 +0000 (UTC) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16S49V5h174698; Wed, 28 Jul 2021 00:25:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=4Gx3yuWP8gfyc1sckN77SlZDFxMMVBCrhffWmMjtUUw=; b=q+GG0QxuCA6uAEqNT3fSrq0c76v4K2R2sbj4PJVNwAC0kp9Ii/UeTFs/07ls0RpBucIb oBdUfosBJm+yponII3iTdCWS0ZijiHqpUqKl0qv0rTlnf1iPPh63D0TnnSSRIssIUEKK iDo1GYyftv7Ftpa/QjxqB95j7k76f4vp3JviHs3MiPyw4jeyvGQT9LZKYti1TK5RDegJ Eaq8Rn5OeJ52UoAEz5kVN3h0nCrD2/EBRFdcbvR8dBdw9+C8yWWOjM1/Xpr7fWPN5HNs LanKfZX1UZY0RE73TIY9bdqIl5lFooBqiK3/Ch+SJlz75aMnCv5MGQq9F+pxF9SsyElE Fw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3a2yrs0h1s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Jul 2021 00:25:58 -0400 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 16S49Ys9174954; Wed, 28 Jul 2021 00:25:58 -0400 Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com with ESMTP id 3a2yrs0h1j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Jul 2021 00:25:58 -0400 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 16S4CE7Q001931; Wed, 28 Jul 2021 04:25:57 GMT Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by ppma02dal.us.ibm.com with ESMTP id 3a23637yup-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Jul 2021 04:25:57 +0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 16S4PuA034800028 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jul 2021 04:25:56 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 87C83B206E; Wed, 28 Jul 2021 04:25:56 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 494B8B206A; Wed, 28 Jul 2021 04:25:54 +0000 (GMT) Received: from skywalker.ibmuc.com (unknown [9.85.68.146]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 28 Jul 2021 04:25:53 +0000 (GMT) From: "Aneesh Kumar K.V" To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, "Aneesh Kumar K.V" , Yang Shi , Michael Ellerman Subject: [PATCH] mm/migrate: fix NR_ISOLATED corruption on 64-bit Date: Wed, 28 Jul 2021 09:55:31 +0530 Message-Id: <20210728042531.359409-1-aneesh.kumar@linux.ibm.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 9YTt8_3rL2DlyQDclsZCdDgAJrF1Gffv X-Proofpoint-GUID: 3Jw56ssilXkyz7REd2cQbG5Y6xspGbcJ X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-07-28_02:2021-07-27,2021-07-28 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 clxscore=1011 adultscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 phishscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2107280022 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 18ECA50210D1 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=q+GG0Qxu; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf01.hostedemail.com: domain of aneesh.kumar@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=aneesh.kumar@linux.ibm.com X-Stat-Signature: o7gmsupbdsg67y7r6ykp71qxhab1xgxd X-HE-Tag: 1627446363-665896 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: 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)))". Fixes: c5fc5c3ae0c8 ("mm: migrate: account THP NUMA migration counters correctly") Cc: Yang Shi Reported-by: Michael Ellerman Signed-off-by: Aneesh Kumar K.V Reviewed-by: Yang Shi --- mm/migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/migrate.c b/mm/migrate.c index 34a9ad3e0a4f..7e240437e7d9 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2068,7 +2068,7 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, 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