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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 901F8C433FE for ; Fri, 18 Nov 2022 09:02:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EXGEZAc2Bj4B6s6mcsaV4eOZP3dRpNYDiVJ8xu+u+yU=; b=RmovS2wmllje1R j2Qgyb56Fi7eGY/Ts2B98x9aheDF4wlw04YSVWBoFETdQ1EDihiRnuVzYZ9v3LvOdsLitYKaC6uAU lWv21Ww4hkXYKN0k1SeCMOMSnNf127g9asRu31B3xULPsas4V9KKbmREIMKHGLdayC0LqaCRvl5uR pl7AV1OYeagfTQ3tTs2rH11F04Yn3QmFpczicTcSnJi+G5L/E5hoYTDM9Nvtra5ATJR+IRZRHlTBV BiGvF9et9paAUE1WUbmPvEQfkDWfJeKf5TaWYoD6EaTBVUvZPXNotiY72jGKl3uxQVYP8ix+vr5Of DutFBJi/EmHWcZkNJVlQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovxFo-002vRi-Qp; Fri, 18 Nov 2022 09:01:44 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovxFk-002vOz-Km; Fri, 18 Nov 2022 09:01:41 +0000 Received: by mail-wm1-x32c.google.com with SMTP id c65-20020a1c3544000000b003cfffd00fc0so3058908wma.1; Fri, 18 Nov 2022 01:01:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=K6hK8A2rAN4d24KDK5ABoo0V031IyWeiGrh9El3YUPY=; b=WMSkKPKVgzPshxJZXoPqCgykFa2Q6jLIDq9gctLfPDbYW+zXN5wTHSIOyT1Eqpzyqy /Oa6/hyYWTWoxAgyQ5e54+GfGzjsC6e7lzw0KFQUOy/KhcOef3ixOCdXPvzhKZ1lnY4v URbbGTQ+S5yFATOWflB8AcCgi1tBqLVboO42SF/ZJ31z45/vWC4Ul3tJnKZ2HayJSeVT +/s4y5x8cNP10J5PiZhhqsDB5LGh/BXwIECwjIm34lqTwr7Lk6d0J3Fu1ouImD0g8LKJ 3Phczu2ipekrMIa8aVYmFGgO1bN2tCRJ/3YTw2xZwUWvwS4L/DAJkXWcKeTON9p6dRyh d1HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=K6hK8A2rAN4d24KDK5ABoo0V031IyWeiGrh9El3YUPY=; b=fH12sb6FpmN97ZCjxXpYs+HgdxxIInK24j+sIeBG/Jm/NKQRYWlChoZL5pVYXYJr2b NgCn3UD6eNTX00Yaqe5I/CUSnxWc1hluDRWSYuh7XeROWaqHVW1UcJiSjZLKTz1yQJ2x HBrKY9ySF5MryP6xs0lhRvovQwzrvRS5xAOQ6EWFOIWst7n4cbTexlD8XIUUmkDS+ErB 6hCg715AdxOmuh7iJlWGTk4SN+2A/k0gHMXIVZ6wW+dLQzL7WWxwIPgWByN9+P3lm/21 KFDMyqJHpj/EX8WFLHU4zo3x8ysisSv08T8/RLx4otBXbWqBYUG/PDZwMBiPiuE3bguI F+nQ== X-Gm-Message-State: ANoB5pmEaGjUEie6svHemt9BpxY4bX5jZnfzQ/g2nK7fqhkUPjgX+43N hx6ArhCMY0UpX+nkiw2hWQs= X-Google-Smtp-Source: AA0mqf69UydmZ4WVQnY3pESaLTvOyJU7cFdL5tejY53onzOZSvxdUOc1AtYvBrSboRJgr+axBmvemQ== X-Received: by 2002:a05:600c:35cf:b0:3cf:aa11:93a8 with SMTP id r15-20020a05600c35cf00b003cfaa1193a8mr7851714wmq.31.1668762097604; Fri, 18 Nov 2022 01:01:37 -0800 (PST) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id 23-20020a05600c229700b003cf75213bb9sm7980034wmf.8.2022.11.18.01.01.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 01:01:37 -0800 (PST) Date: Fri, 18 Nov 2022 12:01:34 +0300 From: Dan Carpenter To: Andrew Lunn Cc: Umang Jain , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Greg Kroah-Hartman , Hans Verkuil , Dave Stevenson , Mauro Carvalho Chehab , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, kieran.bingham@ideasonboard.com Subject: Re: [PATCH 2/3] vc04_services: mmal-vchiq: Use bool for vchiq_mmal_component.in_use Message-ID: References: <20221117160015.344528-1-umang.jain@ideasonboard.com> <20221117160015.344528-3-umang.jain@ideasonboard.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221118_010140_738280_3837086E X-CRM114-Status: GOOD ( 16.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Nov 18, 2022 at 01:23:36AM +0100, Andrew Lunn wrote: > > struct vchiq_mmal_component { > > - u32 in_use:1; > > + bool in_use:1; > > bool enabled:1; > > The patch you referenced says: > > +If a structure has many true/false values, consider consolidating them into a > +bitfield with 1 bit members, or using an appropriate fixed width type, such as > +u8. > > The code did exactly this, using two bits fields, in one u32. A bool > probably takes up 4 bytes, maybe 8 bytes, so this change probably > doubles the storage size for these two fields. In GCC and Clang bools take a byte, but the C language is vague and other compilers are free to do it differently. > Are these fields on the > hot path, where an extra AND instruction would make a difference? This patch takes the first u32 for "in_use" and squeezes it into the same byte as "enabled" so it makes the struct four bytes smaller. There is still a 3 byte struct hole between "enabled" and "handle" so we could add more 62 bool bitfields if we wanted. In the v2 patch these become: bool in_use; bool enabled; One byte each and there is a two byte gap before "handle". regards, dan carpenter _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel