From patchwork Fri Jul 9 10:28:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xu, Yanfei" X-Patchwork-Id: 12367093 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, 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 34759C07E99 for ; Fri, 9 Jul 2021 10:29:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AE102613C9 for ; Fri, 9 Jul 2021 10:29:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AE102613C9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=windriver.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8881E6B0071; Fri, 9 Jul 2021 06:29:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8381B6B0072; Fri, 9 Jul 2021 06:29:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 663736B0073; Fri, 9 Jul 2021 06:29:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0127.hostedemail.com [216.40.44.127]) by kanga.kvack.org (Postfix) with ESMTP id 3BC466B0071 for ; Fri, 9 Jul 2021 06:29:23 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 703EA181CA34D for ; Fri, 9 Jul 2021 10:29:22 +0000 (UTC) X-FDA: 78342677364.38.9A930A6 Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by imf08.hostedemail.com (Postfix) with ESMTP id 7917530000A8 for ; Fri, 9 Jul 2021 10:29:21 +0000 (UTC) Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 169AMME9020730; Fri, 9 Jul 2021 03:29:20 -0700 Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2040.outbound.protection.outlook.com [104.47.51.40]) by mx0a-0064b401.pphosted.com with ESMTP id 39pk1vg214-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Jul 2021 03:29:19 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AhCJShCw9PbhamPSGleyVEWb3rwpamU+QsM3q21OxLzgtVoziM+wMfRXb4ZDTNFMUqnkHdEHq1ExAW6hrh6abTBbpP5o9zAQzlR3OlrO6WW3exiJlXR9n8RDLZWAaHug1N51rucKBMYpst3fAlSwQtl8PePe/n24IbVnvibMUcW3ctrYWJ2XoPElFxiFTw6XpC5lW6q5QUYhfh69socprmprCcAyxFSc9aXdOt5qGSlX2hCv5eCtAd12xMGYANWxSdJ3B5cC2YUajjDrtlNAGV49Pe7dylihNex85A1prvwLktWhoXsvDMW/mGI+JDxqscChG84VblgCRnssnidT3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6CMClUKfUseqhvni4N9tIiaU+3Yt4Zgc5LUUiu/wgHY=; b=RzQn0BMzTmeSDaTcSaOQMTBpIfSEe/JEcwmIDzuSLweID22uvAC1fwD2FPe+SvBEcmbf5OHt1CTowPpsl5UbZQy353WpFwBFpcfMzhm9KGHZ5YhLGNdRWIK9LCBRKh4xDUKY6qoT35N7KbGxuIXSuYiNtmEdLcgIsnHAQdS5DnIgP8Kj0Hae+OWSsQbkOAK/hkAoRr80GcyvK90CY2QUkWG3I4bxqRq3q4dsF5mcMqUuiqlSbR1zroDGgxDojacJ8RZptdQX3fgnK/u27sU6tK+J2Ip+2MaMAoOMG5gc3YTfsAZ4zAbJRpH7VEI/2cdkE5ub3cdcLFwTRml5PUbDNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriversystems.onmicrosoft.com; s=selector2-windriversystems-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6CMClUKfUseqhvni4N9tIiaU+3Yt4Zgc5LUUiu/wgHY=; b=PIWO/R5HwqNGbmfnK/wR4pS1sBoOBYzGvJZzFMMw/yIrYJffbjPS4Mv5HDOYjs2v0p9k+3wbQum+AfK8xhH3Gvo7niYFVquPrNtN0K6z4XqQnsC9BwGvTlTN6Te65m71JHkx89XUOl57MsXjuCyuJu5IDwcOSwjB9zp53oKONPU= Received: from DM8PR11MB5734.namprd11.prod.outlook.com (2603:10b6:8:31::22) by DM6PR11MB3147.namprd11.prod.outlook.com (2603:10b6:5:64::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.21; Fri, 9 Jul 2021 10:29:18 +0000 Received: from DM8PR11MB5734.namprd11.prod.outlook.com ([fe80::bce8:81f7:f5a1:af19]) by DM8PR11MB5734.namprd11.prod.outlook.com ([fe80::bce8:81f7:f5a1:af19%8]) with mapi id 15.20.4308.023; Fri, 9 Jul 2021 10:29:17 +0000 From: Yanfei Xu To: akpm@linux-foundation.org, mgorman@techsingularity.net Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] mm/page_alloc: correct return value when failing at preparing Date: Fri, 9 Jul 2021 18:28:54 +0800 Message-Id: <20210709102855.55058-1-yanfei.xu@windriver.com> X-Mailer: git-send-email 2.27.0 X-ClientProxiedBy: HK2PR06CA0022.apcprd06.prod.outlook.com (2603:1096:202:2e::34) To DM8PR11MB5734.namprd11.prod.outlook.com (2603:10b6:8:31::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pek-lpggp1.wrs.com (60.247.85.82) by HK2PR06CA0022.apcprd06.prod.outlook.com (2603:1096:202:2e::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.20 via Frontend Transport; Fri, 9 Jul 2021 10:29:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d4b4ae5f-186d-49b6-03cb-08d942c467ec X-MS-TrafficTypeDiagnostic: DM6PR11MB3147: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fZX5tUCZZPDtDBLrX3arnOewaJEzyHiMf9lSFMr4TLD0WoAmOpFwMy+C36UNvBD+LWrXtBaPQPAsqy+IS11yKCGf8fuk7UC76lPWV0Q3d57CzpbJ8v2Qj1NqnnlhNNCPz+wwv4LeuxmUajCAgUDr8bxUB/iJH2RgbwnwuAlcnA2+z8VaP4XYiV3q7ek8GDK1btQcRXAHWIYPkSErNLLWba3wUsk/d1OcoUi7WmqcFNz1CzwyP+YX0xFfH26zHYyGjU0Qf2X+gBw1pVfiJfuORfWTImFGvGAaPIG8BWx02tZf3CvweifDSaDeV6AYlWhqGtf21R+T3/s+PlqtcrbqAJg9ALLYRrBth9HlolNNxgNMOH41YSNyZe/an8n8DshefWnBYg9v0a4I5EQ0gXOG0KWEvw4Kd4MqdNHi/Qu+WPSguQfkSFUKL8geq7IKd1y7Lu/ZSoaoRD0SG9FPOp1w95if+gN43qAKTQAk7LAeKv3ZcHRJGaVAkHZxuKbjy4ig42mRSw6bquABAmc4eJLKLla4YtdWM8yWBQdqHzVYyEiRYqOSKfZ0sefhVBSf4o5xwQdCW4QpuIcFd6BFMFhyWeHJfdauyBMat8G8sQ6UXbkKieuTCSMjAomis6uUVLCZMqY2tXYRdSSJK6qtHMwDrqoE4+cWNafO9kVX6ey0HIiIC0B+eVg4oQ4db0VuIGQckYYpF2aGocP+kEno6jhn4g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM8PR11MB5734.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(136003)(346002)(39840400004)(376002)(366004)(26005)(186003)(2906002)(44832011)(6666004)(6506007)(38350700002)(5660300002)(86362001)(83380400001)(36756003)(1076003)(38100700002)(66946007)(2616005)(6512007)(6486002)(52116002)(4326008)(8936002)(8676002)(4744005)(956004)(478600001)(66476007)(316002)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 132XRGzc1aDqVSFea2O/MAgUiHQJhswhtV2ZdW2ooqmRsV2ZsdRCibt7DPRH7BdjZpbNtfxrN1vfzkeTs8P6xlPEQ5LigPWqpcHNROkK9XySYcslMCXsQiXhH4R1xH3eOZGSG7tlIE/qznW1/jpyKUPw/fdiK6kUzPsBvlmDTuEdVWo3TwiHgyFsp1qp3KL2VNa2VfL1lgk8ssu8cu4vszzdgDiOgqUYjuWm5l2Q9VIn1bj5Ain59IenuR30/RXU1GJ6r//XcOFNgpJ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MS-Exchange-CrossTenant-Network-Message-Id: d4b4ae5f-186d-49b6-03cb-08d942c467ec X-MS-Exchange-CrossTenant-AuthSource: DM8PR11MB5734.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2021 10:29:17.7425 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: b0qr/A6y4svKADR8ue3mvcohVLDynLxPJW81VroKmlbEe6J2Y1o3K3qRAG4GfW8Qy6Wiab3t+sBddl/WqYiDNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3147 X-Proofpoint-ORIG-GUID: TVvUoJg1LepXaoOFWGYRTlu3VauxHFeI X-Proofpoint-GUID: TVvUoJg1LepXaoOFWGYRTlu3VauxHFeI X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-07-09_04:2021-07-09,2021-07-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 bulkscore=0 mlxlogscore=798 adultscore=7 clxscore=1011 lowpriorityscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107090053 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=windriversystems.onmicrosoft.com header.s=selector2-windriversystems-onmicrosoft-com header.b="PIWO/R5H"; dmarc=pass (policy=none) header.from=windriver.com; spf=pass (imf08.hostedemail.com: domain of "prvs=282436cc89=yanfei.xu@windriver.com" designates 205.220.166.238 as permitted sender) smtp.mailfrom="prvs=282436cc89=yanfei.xu@windriver.com" X-Stat-Signature: m71ep7unm636p3am4fe9cu7qayoaa4ba X-Rspamd-Queue-Id: 7917530000A8 X-Rspamd-Server: rspam05 X-HE-Tag: 1625826561-377563 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: If the array passed in is already partially populated, we should return "nr_populated" even failing at preparing arguments stage. Signed-off-by: Yanfei Xu --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d6e94cc8066c..e9fd57ca4c1c 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5254,7 +5254,7 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid, gfp &= gfp_allowed_mask; alloc_gfp = gfp; if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &alloc_gfp, &alloc_flags)) - return 0; + return nr_populated; gfp = alloc_gfp; /* Find an allowed local zone that meets the low watermark. */