Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3069418ybc; Thu, 21 Nov 2019 02:53:12 -0800 (PST) X-Google-Smtp-Source: APXvYqy8iQNlGdTyQvm+HVMAV7/VoY/ky4R36YyHjeTZK6lc6tIIOfzQ1quqnmQS4IHiDxAeWl6D X-Received: by 2002:a17:906:f18b:: with SMTP id gs11mr13261628ejb.2.1574333592058; Thu, 21 Nov 2019 02:53:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574333592; cv=none; d=google.com; s=arc-20160816; b=XrIjdfuWAuZhNu85AvuWNuGePn9RDeLD/qcY0Z3UTUYGrg7d4qSK7BczuoZrvvV06V Ra8MpSWEC4wyykDGt3HrcKslFburGgq5aeti3u0/hKco8X5AUqCj9/t6FtXfdLAmg75c DYsO+k7cJQok5JP7VTPu9dEaOGCRWaStXunzL8Qzx4KeuDrMcrHU66rucxuKqpzXrafJ yGEpF59+7c5FribYoAqIflOaepr/XbuK95YzjPCoH0fOZdSnTKCH924VEXesaoXiOiKU fv97xHResqWkTieJu3nvEh5F85rKEv92cU9du13GjlLnVYepY8sme9u2IL1w3jZqDGsK 7IGA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=FdEPe6fpUNXI9/WAZZIOxWELNA+kAoI7dzDky4bTZis=; b=nBuUTEzhiisi8eYGanHOC/wLnpGbJvw1HBd+vYmryuXU4xbCh88RuD8B2nugAvNppx 38k+U7v2BVDNFoiXkwIuvQrgAk4JvH5m2sch0dEDmNbQqXRr5RYH6eNkjaRbr46sGtLP SlSxKwFY69sHTOKOZ4AEY6Ujv9Oek2x7espMIv/Hr/si0tzEGali63O1hd/2dubS+fRR m/m1tMen7LIaD4lCLog/8t7XgC9pRxGh0roe7+hNowUfdrf8g9n9dXycQALxnUzXYpR1 rjbT73bGe+MGZBdd+GcWe1ZYz5wu2+DYpi11n6rGXe1Dkf8OYjZ+Se+XtpI7g9bqXDcV c9Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=cOoelbzV; 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 o22si1486283ejr.78.2019.11.21.02.52.45; Thu, 21 Nov 2019 02:53:12 -0800 (PST) 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; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=cOoelbzV; 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 S1726342AbfKUKvg (ORCPT + 99 others); Thu, 21 Nov 2019 05:51:36 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:35490 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbfKUKvf (ORCPT ); Thu, 21 Nov 2019 05:51:35 -0500 Received: by mail-lj1-f194.google.com with SMTP id r7so2702233ljg.2 for ; Thu, 21 Nov 2019 02:51:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=FdEPe6fpUNXI9/WAZZIOxWELNA+kAoI7dzDky4bTZis=; b=cOoelbzVpuDCXItrFwxTJF/U/0gy8t5gB2RgT8FVGP8uiqR75cwQA4BAtqadKS31di 7G5OJUuaQOGdSbOXKXffvaGa9BFA4s8NJhxsv7eaYcoczQfAPyweOCCyRDu+oKVNkB0r MlUf6jOKZrG14pcYrk0WLpVdLeXGhoCPR22tM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=FdEPe6fpUNXI9/WAZZIOxWELNA+kAoI7dzDky4bTZis=; b=pLufeJ/qq7Gm+/O/6w4vPlYlEJHZXP12boluxF+ClIyPSed3eCpwbt4s7AOjPatkv7 qD2wcG+RADlY06YuCWfidk/XH92txpb5cgLlqkYG80Oan4vw/8j+6k2EB5kqf/hChdOj RSTKlpCSHFrjf3rvCF/wwXLOxnTV4S3vRsdWTzKgfAzKyChS6TOrcLM8anwqDhxdxxcK 7K9p/BGLjcP7Y9xBswQ+sfzWtkPWhOv1jSJXbr2mqe7NFHYel7LjOdzLeedrklaxTWY+ 7xBpZQtQmzyR0YkA0XiCdTODWmOlQbbYxI10IMy3vobtX32uC4LtQmrycROFDWD0Qa67 Xvbw== X-Gm-Message-State: APjAAAWXfeg7iwijdcivVtePpxm/UOweiQRIEkw+N3pHjAOg0zSNq21/ pUgZBxLboOvRfOYXFgB73cNfiQ== X-Received: by 2002:a2e:9e97:: with SMTP id f23mr6817404ljk.89.1574333493384; Thu, 21 Nov 2019 02:51:33 -0800 (PST) Received: from [172.16.11.28] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id p18sm1167891lfh.24.2019.11.21.02.51.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Nov 2019 02:51:32 -0800 (PST) Subject: Re: [PATCH] export.h: reduce __ksymtab_strings string duplication by using "MS" section flags To: Jessica Yu , linux-kernel@vger.kernel.org Cc: Matthias Maennich , Masahiro Yamada , Arnd Bergmann , Greg Kroah-Hartman References: <20191120145110.8397-1-jeyu@kernel.org> From: Rasmus Villemoes Message-ID: <93d3936d-0bc4-9639-7544-42a324f01ac1@rasmusvillemoes.dk> Date: Thu, 21 Nov 2019 11:51:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191120145110.8397-1-jeyu@kernel.org> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/11/2019 15.51, Jessica Yu wrote: > > We can alleviate this situation by utilizing the SHF_MERGE and > SHF_STRING section flags. SHF_MERGE|SHF_STRING indicate to the linker > that the data in the section are null-terminated strings [pet peeve: nul, not null.] > As of v5.4-rc5, the following statistics were gathered with x86 > defconfig with approximately 10.7k exported symbols. > > Size of __ksymtab_strings in vmlinux: > ------------------------------------- > v5.4-rc5: 213834 bytes > v5.4-rc5 with commit c3a6cf19e695: 224455 bytes > v5.4-rc5 with this patch: 205759 bytes > > So, we already see memory savings of ~8kB compared to vanilla -rc5 and > savings of nearly 18.7kB compared to -rc5 with commit c3a6cf19e695 on top. Yippee :) Thanks for picking up the ball and sending this. > /* > - * note on .section use: @progbits vs %progbits nastiness doesn't matter, > - * since we immediately emit into those sections anyway. > + * note on .section use: we specify @progbits vs %progbits since usage of > + * "M" (SHF_MERGE) section flag requires it. > */ > + > +#ifdef CONFIG_ARM > +#define ARCH_PROGBITS %progbits > +#else > +#define ARCH_PROGBITS @progbits > +#endif Did you figure out a way to determine if ARM is the only odd one? I was just going by gas' documentation which mentions ARM as an example, but doesn't really provide a way to know what each arch uses. I suppose 0day will tell us shortly. If we want to avoid arch-ifdefs in these headers (and that could become unwieldy if ARM is not the only one) I think one could add a asm-generic/progbits.h, add progbits.h to mandatory-y in include/asm-generic/Kbuild, and then just provide a progbits.h on ARM (and the other exceptions) - then I think the kbuild logic automatically makes "#include " pick up the right one. And the header could define ARCH_PROGBITS with or without the double quotes depending on __ASSEMBLY__. OTOH, adding a whole new header just for this may be overkill. Rasmus