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 AB601C5478C for ; Tue, 27 Feb 2024 00:30:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1449E4401D0; Mon, 26 Feb 2024 19:30:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F48044017F; Mon, 26 Feb 2024 19:30:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F258B4401D0; Mon, 26 Feb 2024 19:30:05 -0500 (EST) 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 E46F144017F for ; Mon, 26 Feb 2024 19:30:05 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BAEA4C01BC for ; Tue, 27 Feb 2024 00:30:05 +0000 (UTC) X-FDA: 81835701570.13.AF40358 Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) by imf09.hostedemail.com (Postfix) with ESMTP id 2B405140013 for ; Tue, 27 Feb 2024 00:30:01 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=jwUiiVI7; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf09.hostedemail.com: domain of kent.overstreet@linux.dev designates 91.218.175.184 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708993803; 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=cMAF2+RO/i9jccfOlie00oTKoBCg2uxgQRQWz3UieL4=; b=CddU+pZ8Gqi4+i9T2BP5ftjC/ooLo1uqaXIz2J0J5NyUOLSQ1jkM/wYHxEtgzoIWUgeXOO ecKQ/S2PUoyx4+COM1vynFF2bnRQ5cUIcOjF1E6Nao6vlF7ZPMXj8RlUFFqrhQaVKbiHEA oOQ+lTHcrMGVibR6euKIIeu2mCUIy2o= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=jwUiiVI7; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf09.hostedemail.com: domain of kent.overstreet@linux.dev designates 91.218.175.184 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708993803; a=rsa-sha256; cv=none; b=Izc9WVR4fSIEj4/QyFQJs7lEO1y127G30YskQgfuSuTk93K1QUA5D4Nal9TgB+YSApfLa3 rSzzY+y+N/Vdu+oJw8KK3HBPv2aMtIaOpvfHf4xHPGhkp5zYV7PV1TOgCSzQRQER+7INRI vGYWVszaHKcI4iEhp6wJyVi8Dg9Ke8o= Date: Mon, 26 Feb 2024 19:29:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708993799; h=from:from:reply-to:subject:subject: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=cMAF2+RO/i9jccfOlie00oTKoBCg2uxgQRQWz3UieL4=; b=jwUiiVI77v0gv4YJyGN19qrocyA+5zTk9pNVydUoUKl6g5+fomjOXrGbFP0V5qZ6oazBzr vNb5iZlepSDvVzC7vpLaa1J6eK57dM9pP2n/E3CXIxREHZ3pmR8Ne+Jv2xNwv7VtY+Y6J5 K9VEiXlqi7bT3jXvblEeiuhfyzwEGcs= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: "Paul E. McKenney" Cc: Matthew Wilcox , Linus Torvalds , Al Viro , Luis Chamberlain , lsf-pc@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm , Daniel Gomez , Pankaj Raghav , Jens Axboe , Dave Chinner , Christoph Hellwig , Chris Mason , Johannes Weiner Subject: Re: [LSF/MM/BPF TOPIC] Measuring limits and enhancing buffered IO Message-ID: References: <5c6ueuv5vlyir76yssuwmfmfuof3ukxz6h5hkyzfvsm2wkncrl@7wvkfpmvy2gp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 2B405140013 X-Stat-Signature: 1nrw17qtgac94m8fcwcrwyqtt9sfrn9d X-Rspam-User: X-HE-Tag: 1708993801-433458 X-HE-Meta: U2FsdGVkX18MVJMLt/UoDSE+pTiQJX3EBMJNB6Rjj0HoQXLNCGoSBVT+xRD8ew4ML47zoq3NN5ipufRI4e6QxpONNMA4WwCFH4jGqtL0NkqkjuAnLy2dzN0Xw+P8zH+R5q06JyciHU5iS3VwIGguujuJQme+Wkekf6/58Xhu5wEPU18QD8BDnnzeMbt5ri2pHT6TUydViKgKl6XsapBVZgmgOdzz3rwoZP18uZJrxjL696kP8eCyZw+CXeJIf90hj2u3KCi/Z9G27ntLwVhkXcxYk3yHqXsvYToT5crbUgngBybW0Wi5UFf3+n4SeT3tTbdxVFUnLQKLXTEzDLSApCEWyWo3pQALKUrCbiCyfos0GR+iOjqpgVND9qb1StByyq3ylG0GvazplRwSV+QWUQJMZWsvDOheC40gr9lO0moG8PlWHejauSwxz45I9XLKMGDHWbkldnK2JySauaRg+EOJ2VmuKgiAZ84MD3xm8xn7RQWmympl7CfjLGt2yRTUcuuymCixPgit2yaGiDjtVxbY0XEpUrV4PacIBO5QvPBxWbD0RfUpRnsg9y6u6t887ficVASmbN0bsohX4KfbWV0kmOEH+xnXA075+c3AYrzIsNccSRl25EWVjBrDJsEMaLe8L925hRS4ii6tOEyeh2cp8fwcBnDFMPFmkU+tY/3p3qQfjeTkoStmHSVlJva6kANKqAnTqBN5WeU8cjBotiJhgYIAAQyJuAxpuDdxZgOVQduEP7e8+Pl//qVpxgsaLxGPOxXYrSK/2GaipcwAFPY1PDHjWnSmzLzk6Vf+GYo= 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: List-Subscribe: List-Unsubscribe: On Mon, Feb 26, 2024 at 04:05:37PM -0800, Paul E. McKenney wrote: > On Mon, Feb 26, 2024 at 06:29:43PM -0500, Kent Overstreet wrote: > > Well, we won't want it getting hammered on continuously - we should be > > able to tune reclaim so that doesn't happen. > > > > I think getting numbers on the amount of memory stranded waiting for RCU > > is probably first order of business - minor tweak to kfree_rcu() et all > > for that; there's APIs they can query to maintain that counter. > > We can easily tell you the number of blocks of memory waiting to be freed. > But RCU does not know their size. Yes, we could ferret this on each > call to kmem_free_rcu(), but that might not be great for performance. > We could traverse the lists at runtime, but such traversal must be done > with interrupts disabled, which is also not great. > > > then, we can add a heuristic threshhold somewhere, something like > > > > if (rcu_stranded * multiplier > reclaimable_memory) > > kick_rcu() > > If it is a heuristic anyway, it sounds best to base the heuristic on > the number of objects rather than their aggregate size. I don't think that'll really work given that object size can very from < 100 bytes all the way up to 2MB hugepages. The shrinker API works that way and I positively hate it; it's really helpful for introspection and debugability later to give good human understandable units to this stuff. And __ksize() is pretty cheap, and I think there might be room in struct slab to stick the object size there instead of getting it from the slab cache - and folio_size() is cheaper still.