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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2C27C7EE2E for ; Sat, 10 Jun 2023 22:08:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229886AbjFJWIP (ORCPT ); Sat, 10 Jun 2023 18:08:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbjFJWIM (ORCPT ); Sat, 10 Jun 2023 18:08:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3F9E3A87 for ; Sat, 10 Jun 2023 15:08:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 401D761655 for ; Sat, 10 Jun 2023 22:08:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B9C1C433D2; Sat, 10 Jun 2023 22:08:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1686434890; bh=MCsFvVy435UaO9a2k6Ch4D0TT3bNe+I9J5W8nx6Qeb8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kxN1UvBnTCZQG40Rtk8MCWrbWMEX/vfsaNnkp7tb4aTwwvgq/moKjS4R3oQ4+v0u9 L+46ZjVNWlrmWdkhMRJRzFFutZkW6pETOoy9rHjRDxoUBkdxzkcLOwG7bRrC3iSlpN dR2fI0Wa6dWu/Wd2hWBsZMwfvGWemLvsZwZTfRTE= Date: Sat, 10 Jun 2023 15:08:09 -0700 From: Andrew Morton To: Lorenzo Stoakes Cc: David Laight , Lu Hongfei , Uladzislau Rezki , Christoph Hellwig , "open list:VMALLOC" , open list , "opensource.kernel@vivo.com" Subject: Re: [PATCH] mm/vmalloc: Replace the ternary conditional operator with min() Message-Id: <20230610150809.babdc5a7919258f066c8637e@linux-foundation.org> In-Reply-To: References: <20230609061309.42453-1-luhongfei@vivo.com> <832d7c69-ffd5-4764-8ffe-3a02bef0efb0@lucifer.local> <3fc87d60-4e81-4f49-95f0-0503ad5cdf35@lucifer.local> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 10 Jun 2023 22:06:35 +0100 Lorenzo Stoakes wrote: > > > OK, as per the pedantic test bot, you'll need to change this to:- > > > > > > num = min_t(size_t, remains, PAGE_SIZE); PAGE_SIZE is a nuisance. It _usually_ creates the need for a cast: hp2:/usr/src/linux-6.4-rc4> grep -r "min(.*PAGE_SIZE" . | wc -l 117 hp2:/usr/src/linux-6.4-rc4> grep -r "min_t(.*PAGE_SIZE" . | wc -l 279 Perhaps it should always have been size_t. I suppose we could do #define PAGE_SIZE_T (size_t)PAGE_SIZE And use that where needed. Mainly because I like the name ;)