Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1826555rwd; Fri, 9 Jun 2023 02:46:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ISKJjBFPrB40ALuz7SPA+qB7/fdqUy4rb9Q4WOLNbeY2j66uK5NKp//6vHSwf52vq3oGl X-Received: by 2002:a17:90a:19c8:b0:256:1441:95b5 with SMTP id 8-20020a17090a19c800b00256144195b5mr510718pjj.29.1686303995441; Fri, 09 Jun 2023 02:46:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686303995; cv=pass; d=google.com; s=arc-20160816; b=yzfwdhfoLpDny2VTngCAdkvueUZDfRexBBGvdNAb5xG9QxJC7phV+ED6itvLgYKxRv FfFzaF54BRBOqhHh/7ZlfwrmSI/m2bWBLadoPpoViVVzj+dYCAewYseryNUgEzWHj7hk 3zeJs28GeUPkvlTy1l5AUnJmEtJ+snIXti3jhwffuwzPAViBor2QH59m4eD49mMf/e0t +96rYyn3RDjz3UPEaMbGxH8X/U1WjMgZAq1SzaA2qMmaCcRYF9yz+7bbGUMSw1oQF3Pq +4PwmSfotzphdKNog2yC9ED2vRpAnP84o+qGV9G3K4qZSz/7MjYInIVEiGenmzRWUJ+S hwiw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=B+YHe4f1slAs5iIzpI3MmONEWpxRHi0y71k9k3D+3Q0=; b=F3tRoj2yy9KGfYR19C9AwoDNViqZJb9H2pv6sf8ijtkVukK+KEv4x8fWTQGy+75+JH 4nzUyQH94uFfLBaTlNRrek0nIx8pDbvhdJQvuRBZRWvukMeDSh63rGDR+8EmxE4VF43r dEwbz1dh6NCP+sUxDwDw/semlxzfD7fViOmc7e9nn7oHSAoos5y6thsNcXYZKP47yHSB KM/H9FfUOlco9I094Qk/SIjCNWG3AQFjqaBh2XDjAeBj+95uACBOfzRFta+JKfKETBKi 7KwQD/Y0uyszoa0j7U3kh73IU2D0x6lWYqKYQhBxe6W8sPrEUf7uoA/O596MGlYYFC5M /gAg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=VsEYBlef; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kf8-20020a17090305c800b001b03e56a51dsi2379259plb.29.2023.06.09.02.46.23; Fri, 09 Jun 2023 02:46:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=VsEYBlef; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241610AbjFIJcB (ORCPT + 99 others); Fri, 9 Jun 2023 05:32:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241604AbjFIJbr (ORCPT ); Fri, 9 Jun 2023 05:31:47 -0400 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2138.outbound.protection.outlook.com [40.107.117.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A4F0558A for ; Fri, 9 Jun 2023 02:26:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WVu/AgHJFOonW7ynfV7wVO0SFlFi8Ns8Rk+cvNV9MuCwPixu3COH3fY0fnZ+nsl1gQADlKpE10QepPS3w4vJWkRwZUro7blQGDnMpAJIiAbRN9d5sXdgmorbLOvx6ja3rciIcs/nclMHsJa+dkZSSSh1ZC4cnB2WKiAci5bLBmRFDaV3rFTbv5NqDa/eF9W+4KQ6YgHA0dZ5Ph34vGiN8N4nb2mnauhKduM5gWWeTS8rcnJ1WBON6t+iM1OklflxC7Z+wvdWiEEJxCexq1zgp1yBh2IfhCPUXd0yVBvp5jVygb8BqYDBPybzcwEBj6Ug70lWHqlYJ5RX0MThlkVn3A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=B+YHe4f1slAs5iIzpI3MmONEWpxRHi0y71k9k3D+3Q0=; b=HejHaRByrD2kNbo8KZ+f9Vbp+NVKe4CX39szPStsub5ikaC8HZ5xAA/+vKci2Os9U9azNRCjN6vF7uWdXqynHbnsIImIYpWI4GAjqT2zNfvsjU9ALlRBoatrRTlNcgTNiU+vZFTvTGcvGjaPLqdoYA9+moQlpfllQ3ywaJ9ah0Wt7jgRrRnT97T5pHx3+GVIeFGTkebrqye5/W1AJz1TB8/IlQQTDG+Be9MSO7FoXO9pt8ekgM3T9Pk+wkR3IHjc5rwaVVRxLR62y1mto1gRQTWtVyPmiuVjEQLxkb5L23O0Vb4JaArcI0Zj5NmaEPak+g2zwDkpGKURGPu7P07R+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=B+YHe4f1slAs5iIzpI3MmONEWpxRHi0y71k9k3D+3Q0=; b=VsEYBlefRx6f4U3tfG6pO4Z+goQeUy7h5nazO6V/mhISABELQ2p/v5G5po60mvTVNOyo9EsrrO7VqwpMNvfBz+eD3T9biX4R4aRd+SJXsLldTZJldDUKvrCjkL7IL+X+TLjDJXlpRc+D7sp2z61P65jbkdKlXdSEb1z0qSmfZAacC4bJ5tesR6vTMPQF62rmBOYeCd6En15uaUqkGO198r4iaT0majNf0MQLoW28H7WCkMBm2TX7OA3HBUGZRUEI2DrgHwkcbnuWwti9HVHJL1GkwyN/OaPW3ZMLWdvcA6a5Db5QK9vWJk21hmo9Fqpx34ebCVO5nr8rSopTKs/5Xg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB6697.apcprd06.prod.outlook.com (2603:1096:400:451::6) by SI2PR06MB3899.apcprd06.prod.outlook.com (2603:1096:4:fb::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.31; Fri, 9 Jun 2023 09:26:12 +0000 Received: from TYZPR06MB6697.apcprd06.prod.outlook.com ([fe80::f652:a96b:482:409e]) by TYZPR06MB6697.apcprd06.prod.outlook.com ([fe80::f652:a96b:482:409e%5]) with mapi id 15.20.6455.030; Fri, 9 Jun 2023 09:26:12 +0000 From: Lu Hongfei To: Andrew Morton , Uladzislau Rezki , Christoph Hellwig , Lorenzo Stoakes , linux-mm@kvack.org (open list:VMALLOC), linux-kernel@vger.kernel.org (open list) Cc: opensource.kernel@vivo.com, luhongfei@vivo.com Subject: [PATCH v2] mm/vmalloc: Replace the ternary conditional operator with min() Date: Fri, 9 Jun 2023 17:26:02 +0800 Message-Id: <20230609092602.26412-1-luhongfei@vivo.com> X-Mailer: git-send-email 2.39.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: TYCP286CA0168.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3c6::18) To TYZPR06MB6697.apcprd06.prod.outlook.com (2603:1096:400:451::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB6697:EE_|SI2PR06MB3899:EE_ X-MS-Office365-Filtering-Correlation-Id: f89ad603-151b-47b8-5a9b-08db68cb90a5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1ZnDYEqlw4ayVHbNjgiEsn/jCppmEnjj+IiZKTItFH5DO1gQNKuNmLokv9hTiXFK12re8wJ2pZnpOhYQ6FiB/VHmUb3eSHJTSLYvAfe+R+oFVqiPo16qYwPmGYnVG4m8vfTFXL+wIGnV5fJy7jirvci6k0IjG3o/6r13G9ZkdR4LSWz1pqvassCYKVzxdEH98NB2Hm7NVCL2D0DjQvz+kjCnC7uF7qQFUECNoq5AyWn8VtBSEK1T4sC8o0X4EsDPrVVENkn/uD/UiHimixoOrqKDeMLpSNCkjv5bntLPbgNR+lB4PyGALRMtdD+RqEA0SbuJbCX6Dyg5Cp0szaQeAuQGGAiduHf7rdzdb6TVbcc8wXpvWmJM09OFZsbZ16+atX8aYShrlHTBvsl0dHn9GqBCSySkByWAx7Et9TPytnk1F7UzMw+PjWVgPBfoV/ftbdU0FtEBsOEzLR1nQ2XhWtWMe4CHsXjOF7LmwCHLQn+S850jGWq7SECReCWPvyi5nz7vzsKxKCHrJPWygzs2x7UhCkxfzocMr9fnyDwZ7BmPmVn6h92kRGWaQ4eS9MNTrbLhGohRg5IHxAcEIZnBdaCz7OlqkBFp6cuRy446zTGx8//KLbfyOU1fIafqPHeF X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR06MB6697.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(366004)(396003)(39860400002)(136003)(451199021)(2616005)(8676002)(8936002)(4744005)(186003)(41300700001)(2906002)(52116002)(107886003)(6512007)(26005)(5660300002)(1076003)(6506007)(83380400001)(6486002)(478600001)(316002)(110136005)(38350700002)(6666004)(66556008)(86362001)(66946007)(36756003)(66476007)(4326008)(38100700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ynKZaEZhLo6EPYhMwJ9ODASO1rI/qvuH/jkCqNGIBZFfuevYsN9TJS3kPkNM?= =?us-ascii?Q?bCMegZjAm9Vhsr3i9YplJSpqGdnHK9WvUxjo9rr+Z45ww8fLpopOUpIEoQfY?= =?us-ascii?Q?oQHug2ub+dTuOrEGbMYyCGReeYlrw8ted4//P/SZ4Bs24SqgJwrZUHhnear6?= =?us-ascii?Q?KE8D6H8VJTrQp654oALRaxxRKpR+tdJ/kXZhT1onozHx0jnraEhnGgpkTIuD?= =?us-ascii?Q?VdHNMVPe5R0VrYmolvZDkyIhfcw4tYLxpslBgOvelty7A3ibyTF8uUqyW/Yq?= =?us-ascii?Q?hRItMf9yjLhDyMHUGPi1BgTSSqVinTemAv4DW9uAPGZT9OiaZ46X1yM89/OC?= =?us-ascii?Q?UDuEeQYtsXfwjToaJqCbt2MMw/CGpKyZ/EGHJSt6lsKn1+JblkfyCKNDd13/?= =?us-ascii?Q?Ccme1D1I8Ro3KEOpmXL7LmrlV6vJOg8GRGUkgp6jv74a9t/9vw6rCbtVTu50?= =?us-ascii?Q?g9XxwizbVNOALGx1xAXAFzqPvj4OW8wBKL/aOKno+a9pONPCYU/FgrAa7sx1?= =?us-ascii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TrJ2axmxN5eT75ZqgYTP6Tz9?= =?us-ascii?Q?21rk69bOYYg6rz91EhT8Y/TlglYCunOcKRHus7EYIn3m2LQCegNZ9lTR6DsD?= =?us-ascii?Q?UiMbbH9XnCgpOsi+adEXh9kICW/cTxQKPu6G2L1vNDt3AmG/gGw9rIT2deeC?= =?us-ascii?Q?rhN0tQYI184oSMRUP3XVLCEuCaTGaMDv4hgKgGpt?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f89ad603-151b-47b8-5a9b-08db68cb90a5 X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB6697.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2023 09:26:11.9788 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /+/RbIN1WI06LeVN1zb9W+vPNeyQOlLsa9M2t3ylKOFnmNfAW/SZHbjKqILYEDaUBYltJa8JaDWYkk2/N2YWyg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB3899 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It would be better to replace the traditional ternary conditional operator with min() in zero_iter Signed-off-by: Lu Hongfei Reviewed-by: Lorenzo Stoakes --- mm/vmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 29077d61ff81..6125ed506895 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -3571,7 +3571,7 @@ static size_t zero_iter(struct iov_iter *iter, size_t count) while (remains > 0) { size_t num, copied; - num = remains < PAGE_SIZE ? remains : PAGE_SIZE; + num = min_t(size_t, remains, PAGE_SIZE); copied = copy_page_to_iter_nofault(ZERO_PAGE(0), 0, num, iter); remains -= copied; -- 2.39.0