Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3178798rwd; Fri, 16 Jun 2023 13:29:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ52/JqzMHNJy7hkPdj456NeHzKep5Od9e5EO6fb3N8V4RFt+1Q6kANWhJH89gEgIApnLIo/ X-Received: by 2002:a17:90a:6c63:b0:25b:fbdc:dd8 with SMTP id x90-20020a17090a6c6300b0025bfbdc0dd8mr2523978pjj.24.1686947378183; Fri, 16 Jun 2023 13:29:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686947378; cv=none; d=google.com; s=arc-20160816; b=EhB6lTBze8TVQDqG9VTi6GRnaz160OrKYa0XYP9XwufcCDAw0g1R0vOrk/eVXfjbU7 Dymkd2IByMXSjr1reH3rLRD3j3YmbRbgl+PX76a3pVyx7mhW1Ln/V3xtLPWB49PbvQOG XO2lXEYCNF7YbxAbm0/TZX2K1NoBkw16u/mrXz1/AAnhLbhXMrM0dNqZm1znjNxY8Zoo iP4kBrUepS/9QIiS7suDpS9bJvFHwobyrM7zDfspdNbYcvOr+ArwcK/Z9RyWpHetmAiL Y3FSgnEnhZ96/J31nl1ErmZ6+hiJ4Wo7db7hsy9sxQ1iiFIVwUjOXnjyftWcs7XE1hGb pr9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=NI1WOJM+IdC+EuV9SRRv49AsdHjuQEXzoZav+2PpiZ0=; b=0iEl9rjBdgfGv5cP0rG02e7+qTCdtEi3t5fkomM2Jz+WqZCtTOD98cZQXm3ePXTizy SeQw5l9vpyhoxQQSw7akDUCZ11dRw8znAmSKVqEC+KufwSoXy8tSauIpIv8OqT4BsA7G XZUDsfpi1YTQq2+WkqvvWVx1ddmhO5xQYUvDdf01RkGq3t/LdDWUkvZpxNepM7Xt/ewm CXm8J0Wfpj2F5CpAV8m9G8U3ZxBOWrfVu+cQiYg2W0KL7cny/v1BLmbVobkK6JLYnqm8 /vhl5vcmzfa9qcYA8nUUOcK95syNLYe3kozpEoNFvYxQzEOjBGh6M0Y5grapM0SGuwpV /zFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=T5Z5qDMt; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n10-20020a17090a670a00b002563fbb8a85si2325699pjj.111.2023.06.16.13.29.24; Fri, 16 Jun 2023 13:29:38 -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=@linux-foundation.org header.s=korg header.b=T5Z5qDMt; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232738AbjFPTwX (ORCPT + 99 others); Fri, 16 Jun 2023 15:52:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230420AbjFPTwW (ORCPT ); Fri, 16 Jun 2023 15:52:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C546D269D for ; Fri, 16 Jun 2023 12:52:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4912461E81 for ; Fri, 16 Jun 2023 19:52:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74C88C433C0; Fri, 16 Jun 2023 19:52:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1686945140; bh=38PQ8mXTKmNOH9eVGrBGTZ0yea343MVgHP6RoGwZi3E=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=T5Z5qDMt0Hu62+5cHC0iEgIYOW90YxmvaXyL+RPf6gtCSt5bHm//L0HliL/X1pd3k DKe7Gmu31KV6DeR/Ux8wGinhKaSDidZ7pWA/Evc3hXPYytZaBYI4K054oWmcuklJGg WKbzBxLGaOKRePS9i5n/Bu08VzCoXYXgZm1lrh5I= Date: Fri, 16 Jun 2023 12:52:19 -0700 From: Andrew Morton To: Wang Ming Cc: Mike Rapoport , linux-mm@kvack.org, linux-kernel@vger.kernel.org, opensource.kernel@vivo.com Subject: Re: [PATCH v1] mm:Using div64_ul replaces do_div() function Message-Id: <20230616125219.dc2346534d6f279a7527c0b0@linux-foundation.org> In-Reply-To: <20230615075127.6832-1-machel@vivo.com> References: <20230615075127.6832-1-machel@vivo.com> 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 X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,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 On Thu, 15 Jun 2023 15:51:14 +0800 Wang Ming wrote: > Fix the following coccicheck warning: > > mm/mm_init.c:2492:2-8: WARNING: do_div() does a > 64-by-32 division, please consider using div64_ul instead. I guess coccicheck was fooled by the incorrect comment over do_div(). do_div() returns an unsigned long. alloc_large_system_hash() should be using a u64 for `max'. Nobody uses unsigned long long any more. > --- a/mm/mm_init.c > +++ b/mm/mm_init.c > @@ -2508,7 +2508,7 @@ void *__init alloc_large_system_hash(const char *tablename, > /* limit allocation size to 1/16 total memory by default */ > if (max == 0) { > max = ((unsigned long long)nr_all_pages << PAGE_SHIFT) >> 4; > - do_div(max, bucketsize); > + div64_ul(max, bucketsize); > } > max = min(max, 0x80000000ULL);