Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp3414438rwb; Mon, 7 Aug 2023 13:10:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE94D/gWdWTgU0AznR7svulIglMaI88xtkPdQqAiEHmPjkW66zMPaDa6uK1xqzMVg/H8S3c X-Received: by 2002:a05:6a20:1057:b0:137:d14d:79ea with SMTP id gt23-20020a056a20105700b00137d14d79eamr10614475pzc.25.1691439050580; Mon, 07 Aug 2023 13:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691439050; cv=none; d=google.com; s=arc-20160816; b=LOEQVX5QK5ZJv0mvEZW9G1TvsPNZ19Mk5LRzISIqE0/BaGzY1gDgwxVDCzNtxGQnsk d0vRpArM6d3Ldb7JMXoGaor7Bh9URt/0BP8mArwpEC2zaaN40XsaxhPxXN0bKHkB7uD9 LGdNYvVbp3UR7OhA64+ZynMR8B56Pumabx0VGknPCTj+ynH2CgH7T1HUJ7HswOsYfKQi 420xQNrsbOic9T+ncV4wUbRKwm4fnbril/i1xMDrLMuE1L3zWnnjCSEZN/d4cFRmA0OX jn57BSWa5QSdJaYro1BQIhUOcVN4lnKq85c6k3QWjHyvyQ09GDcHEhdrOLVJsdHThVpr csZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=uLrESuDnsmXF0LnLVgvvKKzxJ74Ji/f7/0NisgyaeNY=; fh=6WNc4MQKJ2PVuR+1NcvDj2LMJXZ4guPhuNqgpbYrfHA=; b=bw705g+jJkxuIxvaL65/j6RHRRPsdVPWHyjeLLNPTQL/RyjxBtMgcpf0VWso1rt3tm 7ir+v+cqpbpUpqUdmPAYSNDoa/A61faXcaTSsq3ZBJhUFaIOpp74C6/0KBGDQwYMa6VN FACsOBwvXCMNXJ6cQON2zWRFc8N+4C5lAibhoNI0qlu8gblbZhK0lkRN35F59nYuMTiD n/VtdBkcOVb/7oiCv3VLhilBNvQjF8It6m2K6WAsnni5xxXC36qaVDYddSkLESmLaat8 VEZT2n9a6dsqzTb4J7n1130kbIyT7gyfHRnwgShSUSd9p/t3Z+rEZFzFcN7++aqO0z/r 446Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=XWXEoDjw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cg19-20020a056a00291300b0068753013eddsi6084155pfb.216.2023.08.07.13.10.38; Mon, 07 Aug 2023 13:10:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=XWXEoDjw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230522AbjHGTbs (ORCPT + 99 others); Mon, 7 Aug 2023 15:31:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231177AbjHGTbo (ORCPT ); Mon, 7 Aug 2023 15:31:44 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FD171715 for ; Mon, 7 Aug 2023 12:31:42 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-4fe700f9bf7so1451138e87.0 for ; Mon, 07 Aug 2023 12:31:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; t=1691436700; x=1692041500; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=uLrESuDnsmXF0LnLVgvvKKzxJ74Ji/f7/0NisgyaeNY=; b=XWXEoDjwIoxLdSnNQYBFSi1jX94xWwYgs4i714OjShNXUvW43/woTznr3IeaCP1HKu j7i6M7GAtPEl0AdM0vYHMdp7T+eY1avUVJNuM1YRuyBTsjdxorB0QYXqd1Mww7keuXhp 5PwS1WTmAuEkxJN7z9ApJON4oKGgEXGh2AoV0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691436700; x=1692041500; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uLrESuDnsmXF0LnLVgvvKKzxJ74Ji/f7/0NisgyaeNY=; b=ffdi3TUP1ZVP0EYzyV1PoqhsFC1QNv+RJpM/xcuxGtcYLJPVp37NNhNKok9Zj0RFPy n1Hm85ehKBbI7yxCnwQolbtS0Qbab+AJ4vjiDEo8AN8vKmdnpZwAxh5an/8HzxST5eU8 uJfD5azbvAY8Cp4VdHohFAsaPA5/Z8VQaXce6xmbMvhnPwxJ4WY5lg0MU3rv7EM+31l1 HW+s+yUXs9RdNo64lVEKnFQsNxVm8tGr69wsnSfo1NzEZ9C+INhvDyRR1KF6eQxqsSBp JUuuJyBjDl1J2iATkqqnuWgeJwRsFGwLDTh7FIqgAJxRggaCTOayIxNpRQ2rSb8MsLjK 4klA== X-Gm-Message-State: AOJu0YzEaAuh8WGBB1tYCnc76zhCsOUHJZZRCV3YbY6Z6HLVxGGX0YOk blOJbtn2hFC0+02IgibuYFXt2g== X-Received: by 2002:a05:6512:3696:b0:4fe:61f:3025 with SMTP id d22-20020a056512369600b004fe061f3025mr5912246lfs.61.1691436700291; Mon, 07 Aug 2023 12:31:40 -0700 (PDT) Received: from [192.168.1.128] (77.33.185.10.dhcp.fibianet.dk. [77.33.185.10]) by smtp.gmail.com with ESMTPSA id c18-20020aa7c752000000b0052228721f84sm5609359eds.77.2023.08.07.12.31.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Aug 2023 12:31:39 -0700 (PDT) Message-ID: Date: Mon, 7 Aug 2023 21:31:38 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v2 2/3] lib/vsprintf: Split out sprintf() and friends Content-Language: en-US, da To: Petr Mladek , Andy Shevchenko Cc: Marco Elver , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, Steven Rostedt , Sergey Senozhatsky , Alexander Potapenko , Dmitry Vyukov , Andrew Morton References: <20230805175027.50029-1-andriy.shevchenko@linux.intel.com> <20230805175027.50029-3-andriy.shevchenko@linux.intel.com> From: Rasmus Villemoes In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/08/2023 17.03, Petr Mladek wrote: > I agree that kernel.h is not the right place. But are there any > numbers how much separate sprintf.h might safe? > > Maybe, we should not reinvent the wheel and get inspired by > userspace. > > sprintf() and friends are basic functions which most people know > from userspace. And it is pretty handy that the kernel variants > are are mostly compatible as well. > > IMHO, it might be handful when they are also included similar way > as in userspace. From my POV printk.h is like stdio.h. And we already > have include/linux/stdarg.h where the v*print*() function might > fit nicely. > > How does this sound, please? No, please. Let's have a separate header for the functions defined in vsprintf.c. We really need to trim our headers down to something more manageable, and stop including everything from everywhere just because $this little macro needs $that little inline function. I did https://wildmoose.dk/header-bloat/ many moons ago, I'm sure it looks even worse today. I also did some sparse-hackery to let it tell me which macros/functions/types were declared/defined in a given .h file, and then if some .c file included that .h file but didn't use any of those, the #include could go away. Sure, individually, moving the sprintf family out of kernel.h won't save much (and, of course, nothing at all initially when we're forced to add an include of that new header from kernel.h). But this technical debt has crept in over many years, it's not going away in one or two releases. And use of the sprintf family is very easy to grep for, so it's a good low-hanging fruit where we should be able to make everybody who needs one of them include the proper header, and then drop the include from kernel.h. Rasmus