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 4A35DC02182 for ; Wed, 22 Jan 2025 17:42:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7C09E280002; Wed, 22 Jan 2025 12:42:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7223C280001; Wed, 22 Jan 2025 12:42:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 57499280002; Wed, 22 Jan 2025 12:42:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 32EF9280001 for ; Wed, 22 Jan 2025 12:42:48 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 967131605E7 for ; Wed, 22 Jan 2025 17:42:47 +0000 (UTC) X-FDA: 83035807974.15.38197C5 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by imf01.hostedemail.com (Postfix) with ESMTP id 7856A40006 for ; Wed, 22 Jan 2025 17:42:45 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="mu6/3DU8"; spf=pass (imf01.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.47 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737567765; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=IICD8UPGAZCB4EBlaldQl7oBqIWOMw3Z7H3Rk+fUvSI=; b=WzaH/OB7LnoOA8V9LRsPiDsWXF3Dzj1eHlwe2cGD9cXZqTe3pY5QXfNe4Hihv1rZdit8W4 8In5KKJ4TD+X47QRDLjbFdyR6+mqZ7w220BP1DVov9rx5SOYq+xbURd/wIdcJDiVrh2eks 4gsQQUOy+jRTMJAxm9Gl/S2z+DA4qqU= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="mu6/3DU8"; spf=pass (imf01.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.47 as permitted sender) smtp.mailfrom=urezki@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737567765; a=rsa-sha256; cv=none; b=jEdQbRZ485Y6VYxBAGMffsQuqfx1+Kecn+UVygM8ltiwubQuvGhM4cev/UrSgGuHPfEwO2 GXTwUvi3d0xxPIOwA7HxOIWibsVqb50RZsOVmDWa9eBN5Hq1YMuULYAdzHDzdaD9f7hZLC a+WXfMel4Dv1I1ZlbWqv9idVphtOre8= Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-54024aa9febso46353e87.1 for ; Wed, 22 Jan 2025 09:42:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737567763; x=1738172563; darn=kvack.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from:from:to :cc:subject:date:message-id:reply-to; bh=IICD8UPGAZCB4EBlaldQl7oBqIWOMw3Z7H3Rk+fUvSI=; b=mu6/3DU8F9UuqQRebZd8WQjU38f9L49TsICC9yo6vvZmLDSlaRDhr5PfytYWBCkUEn rrRafCOQ/PwF1OClQrP30/JAkqbsw/Rh69wXCOuFu78nRRuJDHyQwIERJJhDEI/3M8W9 QYX9XAzTL9i9Yh0Pd6QOx5MuAYSwM/DL0WqjlIv18Rd24vfRROzCqQtmyj4bCect5OQk /AupILhUuZGoPCAqorjKxIxJlnsBqfoRJxNrxnB0IpPbaoz+FZhYC1nTYMUAf83vxnIC fIwXVnF156LkAlNoyME+NBaWBZI174BEW7yADVAmLoVz9uFJ/lDy4dxPOLWBSjbayJjS bY+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737567763; x=1738172563; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IICD8UPGAZCB4EBlaldQl7oBqIWOMw3Z7H3Rk+fUvSI=; b=txnk6WEs+Zjbx4IlZA5f6tC4i5cWwAv/K5II4qE82jRnXQkqdqcmHqVyGmf+rrGpis +PWOwoVKAeWzajy/a9bHAGCkIsq8xwB5kcTPyzl5Uyt8wYR+44G2QyxZFK2zOnmeq7TD SEbaPqT6yU/5sNEPyfqvnDZBgTBMYAZXOB/RO9SmRohwCpJfrOuE2vegcc6E3NKh5uyt 4L6wX+YLBqO364MyqzFsY3uxDe4VUq85ekQ13l+uoTmdr4IQVLSKl7ixxi8gO6Eknqcg 4+Wv8T1ZFuD32Nx1VT8rpWinuXKgUx77y2fVSuTPo0PfqP/FFyk+7O+DUMVErEeBgm4t TnFw== X-Forwarded-Encrypted: i=1; AJvYcCXSlKmcMQ7MHoZU/xz4Sc85KiDYEsoHj/iO7iMViBU0G8P0M+0jqSq0FrPZLgxPVpjgfKXol1+LBw==@kvack.org X-Gm-Message-State: AOJu0YxgYXpUrSPXVWinNUPzSO+8qORCFmo4DpcWodqRs1bAEbKz2DWD 8Azd0+tJS4o3PWMVnc9lJPwA20fJhzBDNRCmj0JBmbCU/hXzcEjB X-Gm-Gg: ASbGncvf8A27aeBdrYw8nSQrMCuaEKGs8E4PfDZho2wLHsoPS/V4l7jRjyQN/m68Eqi BVEouZs2p09sZTwlFw3Wz2+y7ZOzQ0tVSNH/HhT21/iC9BIAG2NOSRC1dzi6TrUuGKzXIeNnZ8R mdu0GffVq4vhudBdLDHJvDAUy8LkLf4AYkcHyNLvcFpip87Ymz2SyFyXIXFAugvmzppg7Vqctvk WH7rCgIIUmpyaWA/s/CQB5DEcClp6Qp8gDB2O7cALn6uuavV36/Sp94J+28u1pv8b3D6FyGGbWc SnPAkALvcwxT1o0+5IcFUY/k X-Google-Smtp-Source: AGHT+IHvlxE7aTg+tur1LdnZRCSfrXzoKKsrI8QIgY9dKAWz+5woObHEVJ+wQOO5cMBd1SfQN89BUQ== X-Received: by 2002:a05:6512:2213:b0:540:5253:9669 with SMTP id 2adb3069b0e04-5439c282c1fmr8422812e87.32.1737567763352; Wed, 22 Jan 2025 09:42:43 -0800 (PST) Received: from pc636 (host-217-213-93-172.mobileonline.telia.com. [217.213.93.172]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5439af07ae4sm2308906e87.47.2025.01.22.09.42.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2025 09:42:42 -0800 (PST) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Wed, 22 Jan 2025 18:42:40 +0100 To: Vlastimil Babka Cc: Joel Fernandes , paulmck@kernel.org, Uladzislau Rezki , linux-mm@kvack.org, Andrew Morton , RCU , LKML , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Oleksiy Avramchenko Subject: Re: [PATCH v2 0/5] Move kvfree_rcu() into SLAB (v2) Message-ID: References: <6fb206de-0185-4026-a6f5-1d150752d8d0@suse.cz> <5bb80786-220d-45d2-bd35-51876df4203c@paulmck-laptop> <55931fdd-1d5f-4ffd-8496-fe436171dee2@suse.cz> <970317a9-0283-4eec-94ae-63056659d7de@suse.cz> <7b7b92a3-780e-4db0-a5cf-3e78d79587a2@paulmck-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 7856A40006 X-Stat-Signature: g8asbun5qmjhcsfmikz5puudpui3ocei X-HE-Tag: 1737567765-706899 X-HE-Meta: U2FsdGVkX18ygDZdDwkzgrQfyjvd/s4fQwqE6mBts+u/PxZfXUDcAM+ENsFLoZoICcASOZSSX3hhlsvsSeynCz7MZHqHSpr6CB1cpDdyh3uDf0NKhCzP+wS7YLyQFsEDqbxlCwrVKtK4SX2InDTtAAYIr+CxiNm9rrL3TSSlvME+9QfUPPHRVDW1yagZ7nDnljctCrwabciHoWztk0BaYLgAg/VQHY7Jx4ddLzsr2e9T9kMzeotlOS/cwWkDCHX+geFJ1yJJOu+0/t25J+iMmJ+nK8zYd0P+elJXs6anjzY86roB9bc3TJbpLYQxMhjEQ+u0ipAQ8LYXYiZVafim1Xp3+jkXkwClp/i6xdJVC7e8x/Sz8igdLaqYrNjtBwuwcEbJQDsvYPNfpLnNaq8BSJCAVOanFfJZYoa9jC3M+hTypyEcIMo7gklWrXnI9KKTi1Ru5NIM0HuuZueNWIkF7uYzsg9YMozCtNnbbASuQNHb/GZ5IYWGgrV6KPUAT2QMVUz6OxXbDXZNNdPgCBg7M7v6Te6IFYyVw/381rV1LqVJs7Dw6myyH7G2/dIuwZogBmccrhL8XdcNTAPJ46PBZpI8dHaxyllENGfDQwE2gWKPx7JKAM1TvQ/ghgHCdPwv29KMUS6ig+MYCNu5DJqxgMRRtApGANmPoFPyqrYDcaersX6bCLhOqKnSi6h88cSATragmC9DQBXySgw8HigRswfJKfljO1/1a12vNFV6YhVTe+ZnhtSjN556uis2kzn3yipqXjeK8baN79FAuBvyubgvJScJq4hEwjKEyAk7fVYfcw5zUdZK/qkcB7ZzGaVKCnX4DfhKH3XMJbIu6GYHkntSER29o+gIx6wUxuXlbRyW7VeYye7fmYgtjbUKhBeiIb+cyoNA6F5raOiie9bcNWPbkoaPeRHQGNXqBEs4+DmAtnstFPXAK7Yz2sBt/RQMaKdvrHeZN8cN1d0icq8 vfUBCXSP aPNxArxBngoPxm3enoYJPnJ2z6jorLp/TQMKNQ/Bi43pe6dsNrOQtvmBCBPi7BMMezfCMD8U7wf/iIx0/u1x2mRsRMENACGQdHOvmndZ9jAHYz1WqM7ReQSsmcr6AghYqU2B34WVK5uz2elN1va4ZOmFvcq3YoqgUP4EwAV1q5fvOqeSlESXh/bh55Gi2a2VVZxRXk4CMPxtDcRDdidM1MXQUEglClIxzcshxKMeB6mIofcTCkIPcaUOUXGYgr2miGOusivgng1H2Fg2aw+jmISpplW8YYLsiSEnS/BM801LDehX5Ket3FeadwToEU5irhmSG/EAv2/TJAPWD4fPupxdarMHo5tuspJoT3noranHP6uy6XpYq0ZSGw7tebyEyBsXXPyeFkBDwH437gdoLAQD0lwKizKfFpgAcANjnTTW2hImZeK7LyxpLda66urhPKeXlPeJYBNbC4/1HbnUnMZKfEfnQqgu/nv38D5bM/LuKdug8DDCnmZXgXezAAm7K8Bn3VsA3EChRYCRIS+hdfthRwI+qiykBfzrkSKcV7eaEzRuLbLaZSKqTqA== 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 Wed, Jan 22, 2025 at 05:43:06PM +0100, Vlastimil Babka wrote: > On 1/22/25 16:04, Joel Fernandes wrote: > > On Tue, Jan 21, 2025 at 3:32 PM Paul E. McKenney wrote: > >> > >> On Tue, Jan 21, 2025 at 03:14:16PM +0100, Uladzislau Rezki wrote: > >> > On Tue, Jan 21, 2025 at 02:49:13PM +0100, Vlastimil Babka wrote: > >> > > Right so that's the first Possible solution, but without the #ifdef. So > >> > > there's an overhead of checking __is_kvfree_rcu_offset() even if the > >> > > batching is done in slab and this function is never called with an offset. > >> > > > >> > Or fulfilling a missing functionality? TREE is broken in that sense > >> > whereas a TINY handles it without any issues. > >> > > >> > It can be called for SLUB_TINY option, just call_rcu() instead of > >> > batching layer. And yes, kvfree_rcu_barrier() switches to rcu_barrier(). > >> > >> Would this make sense? > >> > >> if (IS_ENABLED(CONFIG_TINY_RCU) && __is_kvfree_rcu_offset((unsigned long) f)) { > >> > >> Just to be repetitive, other alternatives include: > >> > >> 1. Take advantage of SLOB being no longer with us. > >> > >> 2. Get rid of Tiny RCU's special casing of kfree_rcu(), and then > >> eliminate the above "if" statement in favor of its "else" clause. > >> > >> 3. Make Tiny RCU implement a trivial version of kfree_rcu() that > >> passes a list through RCU. > >> > >> I don't have strong feelings, and am happy to defer to your guys' > >> decision. > > > > If I may chime in with an opinion, I think the cleanest approach would > > be to not special-case the func pointer and instead provide a callback > > from the SLAB layer which does the kfree. Then get rid of > > Right. > > > __is_kvfree_rcu_offset() and its usage from Tiny. Granted, there is > > the overhead of function calling, but I highly doubt that it is going > > to be a bottleneck, considering that the __is_kvfree_rcu_offset() path > > is a kfree slow-path. I feel in the long run, this will also be more > > maintainable. > > > > Or is there a reason other than the theoretical function call overhead > > why this may not work? > > My concern was about the overhead of calculating the pointer to the object > starting address, but it's just some arithmetics, so it should be > negligible. So I'm prototyping this approach now. Thanks all. > You are welcome :) -- Uladzislau Rezki