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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EAF6C001DB for ; Thu, 10 Aug 2023 08:15:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 971BC6B0075; Thu, 10 Aug 2023 04:15:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 922A46B0078; Thu, 10 Aug 2023 04:15:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C1EB8D0001; Thu, 10 Aug 2023 04:15:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 6A2386B0075 for ; Thu, 10 Aug 2023 04:15:23 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 34E7C80E3D for ; Thu, 10 Aug 2023 08:15:23 +0000 (UTC) X-FDA: 81107485326.01.27421BF Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf02.hostedemail.com (Postfix) with ESMTP id 4C4F780020 for ; Thu, 10 Aug 2023 08:15:21 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=fApRWQR+; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf02.hostedemail.com: domain of pmladek@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=pmladek@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691655321; a=rsa-sha256; cv=none; b=S07uTZfcHsh4QKGfk7h+Q/67AgZQDJOKV8gea2X1JweLF5ybp4UinaV/wNGxVb6RgNtUe+ 0cJvNJyf4sYxuy74SBoXt/M3+aCQRAppwW592yAOqFiqMzObvv8wUs/789tM+aq5tpmra5 1r20mGEX5Q6qJz36WJpTMQ6vN+ADaIE= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=fApRWQR+; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf02.hostedemail.com: domain of pmladek@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=pmladek@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691655321; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ElbU9RvDenPkT7xhen9VyORMPFOizJvDYj/Km+R918Y=; b=3FHb3MlTsm6AMvcHTbDbEIjaQ+GpjmL760xkvT9qQrCezUNfjHfzXDKRzkO2L2n7vuDQra KjJEp6v0K7CxrRerJf88N11BMvKKNrH3Fjv+BOPPjkVJFO+N7x53jPIIJ77lH4rC9lJUdQ wDKVRfxKGXOcdgiUrXsdigqiPD31umU= Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id A553A1F38D; Thu, 10 Aug 2023 08:15:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1691655319; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ElbU9RvDenPkT7xhen9VyORMPFOizJvDYj/Km+R918Y=; b=fApRWQR+l08lz0VuQp0eTbUs+RC98pmwi4yDWQd4Go+W+pMrqI1TZLjirEYj87aNVb5+Gl 7IkNlSAOZfUnJUCQhYdib46oNe0OK+pPnt3/N1TAc7tF98k4ogCeVIW3VGUuyashbBE7R9 EZ7sgB8fiGaGCfcDCkkggOprhPFdZ74= Received: from suse.cz (dhcp108.suse.cz [10.100.51.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 3041B2C142; Thu, 10 Aug 2023 08:15:18 +0000 (UTC) Date: Thu, 10 Aug 2023 10:15:17 +0200 From: Petr Mladek To: Andy Shevchenko Cc: Marco Elver , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, Steven Rostedt , Rasmus Villemoes , Sergey Senozhatsky , Alexander Potapenko , Dmitry Vyukov , Andrew Morton Subject: Re: [PATCH v2 2/3] lib/vsprintf: Split out sprintf() and friends Message-ID: References: <20230805175027.50029-1-andriy.shevchenko@linux.intel.com> <20230805175027.50029-3-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 4C4F780020 X-Stat-Signature: tsdzm175f6jbb7nux1aa74urrpqj7s7a X-HE-Tag: 1691655321-245978 X-HE-Meta: U2FsdGVkX18KCJfSvJGhi47g/tlDh10HY9EZz0AVkrcoSKLCmPLuQETtppme7SiY41wyC3oboYfuj88NS6Ku+pp4teL7dHbPuA1cKmKVV9Gb/PKDlsr3gq8PASnbRYJjUp+9e/+NE2ivwbs1p8db+NN+jwqbaeQXVc/62g8onuXslQ43Pggsgw7cqPzIbegu/nwwlEanIwLqrGAtEzij2WJdM+rv8YoVMaSWxJLUuvK+KEl3pWkooUrCqw0ySNPM5W2JIj4GUjL05XAEhlV4iEZkgzhxbBWZQvhIKmOHeGboxGsImuM23ijxaYZE9coiq9uEPVSvBnZBvwpzjSCgB8VrocOOuW6723eB7pnfPpWjR4j/N4t1i6CM5HLggLglxuaX6OK+/RrEkuG8v8AN5JfkMU/eot/v6hnHuwDz5xrIdUIzzOYF4IjTUIUEA6mPIRlRepnxGo4pk83VoP0kSyBGdho924ykHzyl5fGYTsqdpX//GDc4OoG5TEDgMNBKpd+0HWd9yssJDtRZuPLk9ZC7xS/80vTcz+oJaXctvIXsUhMqlIGd4nbNPdPk6S0Zo8QQhl63IViaL7Qk1Swl+YAZp3VKrh1te6GgRFzXV9iCw9V+JFcUWFRDGSpHAkjM1c0kBY+DvZh/96QtPiLvunPtaDuHMkrnX5JkZLNEBrOhwu8plvVk5iVDFhQ5h7H40nSLxpSCHIQxMTe4Q783/q7FRtfORt85Z4LOwNdOZdDAk1HUDUudKUCyeheMNgR4zIciLd2EqyQYDaKm73I9H8d10T/91VJlKZP+BAgrjUWRznM0xH5PhulHh8SZBbXQfRoA1vjeaO8NjM9Rm/cYu5Hpd7azF7dp6t1e0/n9TUNH3BBQtuz734HF3n5srJ4LzHjXJ0HDaNjlXdtpw2Y4OTvV6AbPa5N9IPKFOVFU7n0itaFD1PGMuzLB4ZaiITPyyFCOgRk9ZxSAPPaBBqb AzwXMA+O 4mGl5QEx8ggIqJpPJX9e9E/3qHBHbhO9gDsvbFid4d4GOCT5g67vQtEN7CjUORFSBSjs864MWmHTrGsUlFJb2ELumzaX/qV3eHo3JVtnDbTkCAygP45U+0iBIQ2LHFBs0XJNJVST/ej2wmlSoLtKGM48sGQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue 2023-08-08 15:47:59, Andy Shevchenko wrote: > On Tue, Aug 08, 2023 at 08:41:49AM +0200, Petr Mladek wrote: > > On Mon 2023-08-07 18:13:57, Andy Shevchenko wrote: > > > On Mon, Aug 07, 2023 at 06:11:24PM +0300, Andy Shevchenko wrote: > > > > On Mon, Aug 07, 2023 at 06:09:54PM +0300, Andy Shevchenko wrote: > > > > > On Mon, Aug 07, 2023 at 05:03:19PM +0200, Petr Mladek wrote: > > > > > > On Sat 2023-08-05 20:50:26, Andy Shevchenko wrote: > > ... > > > > > > > How does this sound, please? > > > > > > > > > > Not every user (especially _header_) wants to have printk.h included just for > > > > > sprintf.h that may have nothing to do with real output. So, same reasoning > > > > > from me as keeping that in kernel.h, i.e. printk.h no better. > > > > > > > > (haven't check these, just to show how many _headers_ uses sprintf() call) > > > > > > > > $ git grep -lw s.*printf -- include/linux/ > > > > include/linux/acpi.h > > > > include/linux/audit.h > > > > include/linux/btf.h > > > > include/linux/dev_printk.h > > > > include/linux/device-mapper.h > > > > include/linux/efi.h > > > > include/linux/fortify-string.h > > > > include/linux/fs.h > > > > include/linux/gameport.h > > > > include/linux/kdb.h > > > > include/linux/kdev_t.h > > > > include/linux/kernel.h > > > > include/linux/mmiotrace.h > > > > include/linux/netlink.h > > > > include/linux/pci-p2pdma.h > > > > include/linux/perf_event.h > > > > include/linux/printk.h > > > > include/linux/seq_buf.h > > > > include/linux/seq_file.h > > > > include/linux/shrinker.h > > > > include/linux/string.h > > > > include/linux/sunrpc/svc_xprt.h > > > > include/linux/tnum.h > > > > include/linux/trace_seq.h > > > > include/linux/usb.h > > > > include/linux/usb/gadget_configfs.h > > > > > > Okay, revised as my regexp was too lazy > > > > > > $ git grep -lw s[^[:space:]_]*printf -- include/linux/ > > > include/linux/btf.h > > > include/linux/device-mapper.h > > > include/linux/efi.h > > > include/linux/fortify-string.h > > > include/linux/kdev_t.h > > > include/linux/kernel.h > > > include/linux/netlink.h > > > include/linux/pci-p2pdma.h > > > include/linux/perf_event.h > > > include/linux/sunrpc/svc_xprt.h > > > include/linux/tnum.h > > > include/linux/usb.h > > > include/linux/usb/gadget_configfs.h > > > > This is only a tiny part of the picture. > > > > $> git grep sc*n*printf | cut -d : -f1 | uniq | grep "\.c$" | wc -l > > 5254 > > $> find . -name "*.c" | wc -l > > 32319 > > > > It means that the vsprintf() family is used in 1/6 of all kernel > > source files. They would need to include one extra header. > > No, not only one. more, but the outcome of this is not using what is not used > and unwinding the header dependency hell. > > But hey, I am not talking about C files right now, it's secondary, however > in IIO we want to get rid of kernel.h in the C files as well. This sounds scary. Headers and C files are closely related. IMHO, it does not makes sense to split header files without looking how the functions are used. Everyone agrees that kernel.h should be removed. But there are always more possibilities where to move the definitions. For this, the use in C files must be considered. Otherwise, it is just a try&hope approach. > Also, please, go through all of them and tell, how many of them are using > stuff from kernel.h besides sprintf.h and ARRAY_SIZE() (which I plan > for a long time to split from kernel.h)? I am all for removing vsprintf declarations from linux.h. I provided the above numbers to support the idea of moving them into printk.h. The numbers show that the vsprintf function famility is used quite frequently. IMHO, creating an extra tiny include file will create more harm then good. By the harm I mean: + churn when updating 1/6 of source files + prolonging the list of #include lines in .c file. It will not help with maintainability which was one of the motivation in this patchset. + an extra work for people using vsprintf function family in new .c files. People are used to get them for free, together with printk(). Best Regards, Petr