Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1888276imm; Tue, 2 Oct 2018 16:07:36 -0700 (PDT) X-Google-Smtp-Source: ACcGV612ixAmhxJ6oeVhUtW6k9/+arBqxo7pBDyjntSlmvdMMjSO1Ud+DbBLD0/dCUl46Mo+y+0V X-Received: by 2002:a17:902:b484:: with SMTP id y4-v6mr16992881plr.262.1538521656881; Tue, 02 Oct 2018 16:07:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538521656; cv=none; d=google.com; s=arc-20160816; b=0xnQ3yd5r8W8FQ2n51ZwwlSZJrQ9X0o2pWoEw+ve7EBUl2L9OCZ6QPvhdq86jsmW6m 8F0frWlcQRs+NUaK+LnImcn8UraUpnVezRahc59l1Qm4zn0IOtx8FRDU/u5WQBH3tdER BOfQztbZuQPJgUApdCuQgoOogUqzF14yEl9YscPOfLIb3C3JomKd2ZvfPQmYckM+NzI/ 56f5/jjoRPWXMLYFjLU/UH2E2O28Ycj3I9rvSfUvGY1fJXcuB3oFg/mwZG/+r2nxSjOu wyYoHdBt30Hqep1hFrfXNSXacJXB9qjfFDMcN2l++8oEJq11anDu/QArr9uvRjx/WckO EYsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=Jgn3x29TLqlDShyodvnATB2J6qvN3hbeOkOfMWO96M8=; b=0htTQN32ujxfDK9OUaOIiRe3IPNQmPjYZfsRPa3MAxcnbzSTMZyQJSVqdchNoZx9z0 8XP70vz4wwxen5cpw1LSDdtk2A8pPhZVPvYftMXGR3RNLN4tpDx//pMsibM8ygfSVZkV YKRppY16GPHUCdvosFUpf9NIktDP1JeqCdHm82IJEJbCun8jr6UJPykPiEzMuGegsRCd JAL4PHm9Ci9SV4RB+/ZJb+RIMcTyxOgBmCogfwq9aAN52ui8Gvua6B97FsgmKqeEqZub Sevr/u3gDtFZRTI7kEf/DV4IIJ8423LnabRfWBukHlp/1LUvPbOe7EgSLzxD9UdwFEg5 cLNw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w24-v6si13211497pll.346.2018.10.02.16.07.21; Tue, 02 Oct 2018 16:07:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727225AbeJCFwS (ORCPT + 99 others); Wed, 3 Oct 2018 01:52:18 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:40693 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725744AbeJCFwS (ORCPT ); Wed, 3 Oct 2018 01:52:18 -0400 Received: by mail-pf1-f194.google.com with SMTP id s5-v6so687881pfj.7; Tue, 02 Oct 2018 16:06:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=Jgn3x29TLqlDShyodvnATB2J6qvN3hbeOkOfMWO96M8=; b=pDm/fqBsN2jFUkdHv5YbwcK4K+HJxTZ5li5BoPucFyeh5yg2+BNu6mPLKJyGmx1qZC 4PP+M8rtKixNS6Py6dfHZ0xoih3gBo4pQKk7W9pmYsgyVjgx19eJCCbXjTsJy33i/i4u R745RNdHbG02EZQSIofH6B/DUbRhzOAzq6Acv3muDC7RDITcxfRGiHRUM3mZmZzG5qzZ NHyN9UrM9IVr5syLLcESWXWT1VEx+rhLRKjF3brKaJe1v20lPx8CDxfOAwOTBTlB0Web PPjltCefAJYZDiT1/wgMEIlO/ycjoaYqhQdGKVt4NI7Fi6bweIbvxSLPNdNJ5980Z+Ly Jp0w== X-Gm-Message-State: ABuFfohsh+uUPWDnu1hgoNmCQfQl3ivyLByOmUbAfFzvvZlBvrbos2yC 9b8r5kxsGEBN8Hh2Gl9YO3c= X-Received: by 2002:a63:3e06:: with SMTP id l6-v6mr15818437pga.96.1538521593882; Tue, 02 Oct 2018 16:06:33 -0700 (PDT) Received: from ?IPv6:2620:15c:2cd:203:5cdc:422c:7b28:ebb5? ([2620:15c:2cd:203:5cdc:422c:7b28:ebb5]) by smtp.gmail.com with ESMTPSA id c2-v6sm23422282pfo.107.2018.10.02.16.06.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Oct 2018 16:06:33 -0700 (PDT) Message-ID: <1538521591.193396.8.camel@acm.org> Subject: Re: [PATCH] libosd: Remove ignored __weak attribute From: Bart Van Assche To: Nick Desaulniers Cc: Nathan Chancellor , ooo@electrozaur.com, "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, LKML Date: Tue, 02 Oct 2018 16:06:31 -0700 In-Reply-To: References: <20180930205448.26205-1-natechancellor@gmail.com> <10b12992-3570-4646-374b-82cbd7276839@acm.org> <1538503063.193396.6.camel@acm.org> Content-Type: text/plain; charset="UTF-7" X-Mailer: Evolution 3.26.2-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2018-10-02 at 15:33 -0700, Nick Desaulniers wrote: +AD4 On Tue, Oct 2, 2018 at 10:57 AM Bart Van Assche +ADw-bvanassche+AEA-acm.org+AD4 wrote: +AD4 +AD4 Explicitly initialized global and static variables end up in the .data +AD4 +AD4 section and need space in that section. +AD4 +AD4 Unless the initial value is zero. +AD4 https://godbolt.org/z/curRoO +AD4 +AD4 So you don't wind up with an increase in binary size simply by having +AD4 global variables initialized to zero, right? Instead the kernel knows +AD4 to create a zero'd out mapping for bss. You don't need a run of zeros +AD4 in the binary. +AD4 +AD4 So I disagree when you said earlier +ACI-zero initializers should be left +AD4 out to minimize the size of object files.+ACI I assert they don't affect +AD4 the size of the binary. +AD4 +AD4 If you had many global variables all initialized to zero, why would +AD4 you encode that many zeros in a binary, when you can just set a size +AD4 on the bss section and have the kernel create the appropriate sized +AD4 and zero'd mapping? +AD4 +AD4 +AD4 That is not the case if the +AD4 +AD4 initializer is left out and these variables end up in the .bss section. +AD4 +AD4 From my above link, gcc will put globals without initializers into +ACI-common.+ACI No matter what particular compiler versions do with explicit initialization to zero, the preferred kernel coding style is to leave out such explicit initialization. Bart.