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 BBD04C433EF for ; Mon, 20 Jun 2022 15:07:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EE2AD6B0071; Mon, 20 Jun 2022 11:07:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E6A5D6B0073; Mon, 20 Jun 2022 11:07:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE59C8E0001; Mon, 20 Jun 2022 11:07:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id BA98F6B0071 for ; Mon, 20 Jun 2022 11:07:23 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7CCFC33714 for ; Mon, 20 Jun 2022 15:07:23 +0000 (UTC) X-FDA: 79598942766.29.4967ED3 Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) by imf26.hostedemail.com (Postfix) with ESMTP id 0CCC31400AD for ; Mon, 20 Jun 2022 15:07:22 +0000 (UTC) Received: by mail-qv1-f53.google.com with SMTP id 89so16312868qvc.0 for ; Mon, 20 Jun 2022 08:07:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=gOTFxkGUqMupIw22AxS/Rx8lIZoYdQhdeAt9oipInOQ=; b=nGz6JXChASVFK16Z11+FZHiHcu/oPhoi4TDFXPqfeIYM3weFxOXE5d5yKyqrsA8twT rSF6U6BAAcwcEvJx6eZVUdlXk3fGIa1UKeeuprlOlF8addMXTqwonC8dtxEATCi1H3sL Pg01qgPGnp5Sh0HA3z8CavZcEN6DEIp7a588glqb4bXjnIDDRxOdbGeWRjZzUUn5GTxQ fZJGbr8oL1pg/5N8i5bjBx24EIeJomjiApPwaHcZe0Gb5PU5y51UAS9RUQ6/oGdloFMw znHSbdVgVuSmIpKKim7L8rWI6RGdQ4+bwhfjy7wF/fgz2SswOdxFtddPCgY1AuCEZ7Ot MzvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=gOTFxkGUqMupIw22AxS/Rx8lIZoYdQhdeAt9oipInOQ=; b=zcKJ2zGSHhKUuj3IpBVV9vMkgQxKHVbE5/kJcmfG2RKRi1F7NfisvmMkJQozVKsYbW xGkTzciZSHOzYgqd/vX5PbljXJ2QJwdkDnkDYlJ9hp6NMdCt1VSPIGobkVJUqNNMz8VA UOHVnIIkNJbyQ0LRkp1KZbV/5vMJOpVVb2tUwXnqq1G0bCswnfNohNviwWKiIqErgxGb JuczaCnXFFScesB9uwHtBimcBQ1sF8GTHi/TSmPoVBpkR7minOjFb+KJDcEwNtJst5Rc 70xw/xjOrHXofXEA9NvF+POndB+LhiAkZpNGb1oZgUoP82Zfb9RwHypiWNP5gsAroaBt eHsQ== X-Gm-Message-State: AJIora90u7ReZiSbVi28wVCbX0crCLk/w0O4lIX957o2l1foDj1V+zw4 3zWY+uy9F9mkSMUKE1NYKw== X-Google-Smtp-Source: AGRyM1u7rJu4JgvhcW8gXh8UcVQZ1bu+UwmmklndWij/TRVUJ58+t67cAb8NQnR+v4XDuUq5MVr/5w== X-Received: by 2002:a05:622a:3d0:b0:305:2e8e:e185 with SMTP id k16-20020a05622a03d000b003052e8ee185mr20509541qtx.418.1655737642238; Mon, 20 Jun 2022 08:07:22 -0700 (PDT) Received: from localhost (c-73-219-103-14.hsd1.vt.comcast.net. [73.219.103.14]) by smtp.gmail.com with ESMTPSA id x9-20020ac84a09000000b00307c8b4f5ccsm8414441qtq.52.2022.06.20.08.07.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jun 2022 08:07:21 -0700 (PDT) Date: Mon, 20 Jun 2022 11:07:20 -0400 From: Kent Overstreet To: David Laight Cc: "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "pmladek@suse.com" , "rostedt@goodmis.org" , "enozhatsky@chromium.org" , "linux@rasmusvillemoes.dk" , "willy@infradead.org" Subject: Re: [PATCH v4 00/34] Printbufs - new data structure for building strings Message-ID: <20220620150514.3tjy5dv7pv5frcwd@moria.home.lan> References: <20220620004233.3805-1-kent.overstreet@gmail.com> <0a5901f8460f452a89c9b0cda32fb833@AcuMS.aculab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0a5901f8460f452a89c9b0cda32fb833@AcuMS.aculab.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655737643; a=rsa-sha256; cv=none; b=peHe4oJrlL0MFqhK2wbmBfEN/sTh0wALL5ouUJg4K6VaMCpC5BiXcEwLuqAHJ5yRGrVJS2 MjJwlqU1Vq2TIg2k3XayMy2/Uih/Nn4SvAYVa9e5ajgMevd1BNJLcZeDLx5tdRiAv7XVIG J6imGVmfEyUn0c9kZ1/pKr1Qcm6gtvA= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nGz6JXCh; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of kent.overstreet@gmail.com designates 209.85.219.53 as permitted sender) smtp.mailfrom=kent.overstreet@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655737643; 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=gOTFxkGUqMupIw22AxS/Rx8lIZoYdQhdeAt9oipInOQ=; b=FKLvDUgvlUYvk+znibw/7Mo5g2Xah2oM1zXU+t41Z9A1k89jXA8bOdpTZmzBdiXzDDdt2v 9/8YbaUrYx7kwArt0QfslrlHQwE2RnZkKD5eM6V334YfCPHmp3op6K2fZFaloVLJQ+aqhL wKEXimZffxRshanL8zfV6tTiHGwuTWU= Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nGz6JXCh; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of kent.overstreet@gmail.com designates 209.85.219.53 as permitted sender) smtp.mailfrom=kent.overstreet@gmail.com X-Stat-Signature: u1zuht8fujie7g4iz4qwutksza31h8jx X-Rspamd-Queue-Id: 0CCC31400AD X-Rspam-User: X-Rspamd-Server: rspam03 X-HE-Tag: 1655737642-458947 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 Mon, Jun 20, 2022 at 04:19:31AM +0000, David Laight wrote: > From: Kent Overstreet > > Rasmus pointed out that -fno-strict-aliasing is going to cause gcc to generate > > nasty code, and indeed it unfortunately does but according to worst case > > scenario microbenchmarks it's not a problem for actual performance. > > Just copy some of the structure members to local variables > and, if necessary, write them back at the end. You must not have read any of the code - half the point of this patch series is implementing proper helpers for printing chars, strings of bytes, etc. and that doesn't work if we're not using actual types. > > printk("%pd", dentry); > > > > becomes > > > > printk("%pf(%p)", prt_dentry, dentry); > > > > My OOM debugging & reporting patch series that builds off of this uses this > > to solve a very real problem that Michal Hocko brought up at LSF - with this > > we write shrinkers_to_text(), slab_to_text() which can _also_ now be used for > > reporting in debugfs (which Roman has been working on), as well as in the > > show_mem() report - the "%pf()" syntax lets us print the output of those > > functions without allocating (and having to preallocate) a separate buffer. > > I really think that is a bad idea. > printk() already uses a lot of stack, anything doing a recursive > call is just making that worse. > Especially since these calls can often be in error paths > which are not often tested and can already be on deep stacks. We went over this before - this patch series drastically reduces stack usage of sprintf by eliminating a bunch of stack allocated buffers. Do try to keep up...