Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp56147ybx; Tue, 29 Oct 2019 14:15:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpQ/bHxSG7CKqjAoXU4MqCu97lMvo9ZlJdTxSg74ObKEyXV6Q7PGb0MzyUeVRJ5YIFBRgp X-Received: by 2002:a50:aad2:: with SMTP id r18mr28559779edc.44.1572383748246; Tue, 29 Oct 2019 14:15:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572383748; cv=none; d=google.com; s=arc-20160816; b=djDLha0wQJx7UfAg4K7MQPrgxRKqSN1AAK5UF6dlTqzEiKgyFpOhKaFQQvYsa3rZnM b+amZJtzSPZO5ndB71qbBQyrUWa8rLYPaNHJCAmYf7P3g0cznAGSe4kTv2c/K1eQ5Fg0 FKe+iPTOrh8TMtmMYDe6BaVna3KaAA9Lb4hCmTF2IkQ+lwqqggBTqtJNKvQkTGQ4I28A 6sPCvhqwschLzpKzkmLqBHcz5Xg37oeCudLlsOErXjwjCLQ1jmiNQBMX5iYY8YfK8oVk pfY0EaQsRjh4rzFgIkbeG81UyHlrCYzM1po4jKKv63Nd7IPW8tVw3mqnYG7NZmCK26os 6DCg== 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=jzc5SphXTBrdUOnsHcsz6Kv2zKhcckogB+EMxfSC+W4=; b=LegCTkQCxEtqpaREAzrXINt2Hb/7PJVPvzOqWUGqAbB5anmdANSUNoObQk3/f0JW5C e8nDFRaZHuaXvrQhhihHxPmecEYAI+LDKVyaIiwROpeHbocP9ni+esxWnIb2DNpxtJfD JBMKWrHM0EztLY7xoLNQsSCcZoQzgIDyeoYdEnNNND/PlBZML+x3thOgjkaqGVQ/0hcU prTy8fNR83/1DIJy59D8Ssh9CVDhOTyEvbubxMmuXm9GmPr1PbbpDyUuLKQ10xE9vsde Puq9zJ18SoH8diYp0E1plRpIjZA6cqLJf9feKuW4Dm/uU2+xFXnUAWLFZu339wsQ/NQu PH3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=GzRBZMkn; 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 f13si10964245edl.170.2019.10.29.14.15.23; Tue, 29 Oct 2019 14:15:48 -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; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=GzRBZMkn; 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 S1728227AbfJ2VLu (ORCPT + 99 others); Tue, 29 Oct 2019 17:11:50 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42983 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726747AbfJ2VLt (ORCPT ); Tue, 29 Oct 2019 17:11:49 -0400 Received: by mail-wr1-f67.google.com with SMTP id a15so2932480wrf.9 for ; Tue, 29 Oct 2019 14:11:48 -0700 (PDT) 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=jzc5SphXTBrdUOnsHcsz6Kv2zKhcckogB+EMxfSC+W4=; b=GzRBZMknZ6PJjqjSg7LcletNje7HHjxj2/Py6Vgos74AI/KzFBUTImuNepZmauCZxp xW9pq09rGBWK5BFK4Lbsy/PHbnCyKiNI+z3dC5Xh1hPQxChHD8YO/kd7p1RYrjoiLLQi x/or0KdFUGqKLXyadfMjgS/sUeKYoEVgYJ/2A= 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=jzc5SphXTBrdUOnsHcsz6Kv2zKhcckogB+EMxfSC+W4=; b=W3UAJqJlx4/2A6AaCWMMASLW42DbM0QSbKl4WxX3ItTUoYPodDvA2dPIx9dIzS2q3p 3hmEzkaBPl7ngaa6MfgU0l5z6XML8UWk6Q9n5VrG1D7A7YP1qfE53+ZXGz2QDOJQCXAg 6aNp42RVteyjyse2ArOSbcUDa78PypjE7FtbFouKmGsi9jXnMIcqyogZ9Y49LjfzysuP o/Tmu/I+HuKszOv9kP/WM+sRqHAUJnySLhWHTxCdPQazWfsS9439VxFKsSmJykU0BRYP GfHui0YSwK7Dpk62CgALa7kPW2CgXozD2KTkHW7BfC+iGszz2T9BZwB9tf4mVfw1LTjL yWZg== X-Gm-Message-State: APjAAAUSpAkr2a9YLqHIHLHSGCRxMkczvrR8uzM4UGbmt+TM3h003kxx wsQiOqFvhIM/7GXJLSOranF7F42G34idxUkd X-Received: by 2002:a05:6000:92:: with SMTP id m18mr22618873wrx.105.1572383507160; Tue, 29 Oct 2019 14:11:47 -0700 (PDT) Received: from [192.168.1.149] (ip-5-186-115-54.cgn.fibianet.dk. [5.186.115.54]) by smtp.gmail.com with ESMTPSA id l26sm4251157wmg.3.2019.10.29.14.11.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Oct 2019 14:11:46 -0700 (PDT) Subject: Re: [PATCH 4/7] module: avoid code duplication in include/linux/export.h To: Jessica Yu Cc: Masahiro Yamada , Matthias Maennich , Greg Kroah-Hartman , Joel Fernandes , Martijn Coenen , Will Deacon , Will Deacon , linux-kernel@vger.kernel.org References: <20190927093603.9140-1-yamada.masahiro@socionext.com> <20190927093603.9140-5-yamada.masahiro@socionext.com> <20191029191925.GA19316@linux-8ccs> From: Rasmus Villemoes Message-ID: Date: Tue, 29 Oct 2019 22:11:45 +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: <20191029191925.GA19316@linux-8ccs> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/10/2019 20.19, Jessica Yu wrote: > +++ Rasmus Villemoes [27/09/19 13:07 +0200]: >> On 27/09/2019 11.36, Masahiro Yamada wrote: >>> >>> A typical kernel configuration has 10K exported symbols, so it >>> increases 10KB in rough estimation. >>> >>> I did not come up with a good idea to refactor it without increasing >>> the code size. >> >> Can't we put the "aMS" flags on the __ksymtab_strings section? That >> would make the empty strings free, and would also deduplicate the >> USB_STORAGE string. And while almost per definition we don't have exact >> duplicates among the names of exported symbols, we might have both a foo >> and __foo, so that could save even more. >> >> I don't know if we have it already, but we'd need each arch to tell us >> what symbol to use for @ in @progbits (e.g. % for arm). It seems most >> are fine with @, so maybe a generic version could be >> >> #ifndef ARCH_SECTION_TYPE_CHAR >> #define ARCH_SECTION_TYPE_CHAR "@" >> #endif >> >> and then it would be >> section("__ksymtab_strings,\"aMS\","ARCH_SECTION_TYPE_CHAR"progbits,1") > > FWIW, I've just tinkered with this, and unfortunately the strings > don't get deduplicated for kernel modules :-( > > Apparently ld does not do the deduplication for SHF_MERGE|SHF_STRINGS > sections for relocatable files (ld -r), which kernel modules are. See: > > ?? https://sourceware.org/ml/binutils/2009-07/msg00291.html I know :) > But, the strings do get deduplicated for vmlinux. Not sure if we can > find a workaround for modules or if the benefit is significant enough > if it only for vmlinux. I think it's definitely worth if, even if it "only" benefits vmlinux for now. And I still hope to revisit the --force-section-merge some day, but it's very far down my priority list. Rasmus