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 X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 3DBBCC4361A for ; Sat, 5 Dec 2020 18:22:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ED27E23138 for ; Sat, 5 Dec 2020 18:22:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730321AbgLEST6 (ORCPT ); Sat, 5 Dec 2020 13:19:58 -0500 Received: from netrider.rowland.org ([192.131.102.5]:55771 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1728247AbgLESCy (ORCPT ); Sat, 5 Dec 2020 13:02:54 -0500 Received: (qmail 1179704 invoked by uid 1000); 5 Dec 2020 10:15:11 -0500 Date: Sat, 5 Dec 2020 10:15:11 -0500 From: Alan Stern To: Minh =?iso-8859-1?B?Qvlp?= Quang Cc: Felipe Balbi , Greg Kroah-Hartman , Corentin Labbe , Jules Irenge , Andrey Konovalov , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] USB: dummy-hcd: Fix uninitialized array use in init() Message-ID: <20201205151511.GA1179536@rowland.harvard.edu> References: <1607063090-3426-1-git-send-email-minhquangbui99@gmail.com> <20201204161249.GA1141609@rowland.harvard.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Dec 05, 2020 at 07:47:01PM +0700, Minh Bùi Quang wrote: > Vào Th 6, 4 thg 12, 2020 vào lúc 23:12 Alan Stern > đã viết: > > Does this initialization end up using less memory than an explicit > > memset() call? > > You mean speed? No, I mean memory space. A memset call requires a certain amount of instruction space (to push the arguments and make the call) but no static data space. Initialization requires some instruction space (to copy the data) and static data space as well (to hold the data that is to be copied). Alan Stern > In my opinion, there is no difference in speed between 2 ways. > When I compile this array initialization using gcc 5.4.0, this > initialization becomes > mov instructions when MAX_NUM_UDC=2 and becomes rep stos when > MAX_NUM_UDC=32. I think it makes no difference when comparing with memset() > > Thanks, > Quang Minh