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 E3027C77B73 for ; Wed, 24 May 2023 13:53:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7233E900002; Wed, 24 May 2023 09:53:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D19B6B0075; Wed, 24 May 2023 09:53:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 599F2900002; Wed, 24 May 2023 09:53:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 463436B0074 for ; Wed, 24 May 2023 09:53:52 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 16F8F1A04AD for ; Wed, 24 May 2023 13:53:52 +0000 (UTC) X-FDA: 80825291904.27.0C531CC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf09.hostedemail.com (Postfix) with ESMTP id 365A3140009 for ; Wed, 24 May 2023 13:53:49 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="Ikzq/7Dr"; spf=pass (imf09.hostedemail.com: domain of mtosatti@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=mtosatti@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684936429; 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=3/JE+/VA6wS2JR/X9eVdEeZwiqUU8bEuDrv3SbGQ10E=; b=wr4Fr4zUOOCzb8m6+x0jKhZpsWbcwWAQEVpQ+K3P7MjGQLKtnW+HcgjFb1rNPggNKSq/zR R+q18B33zf8Rc6Tt9L1jWCGq/NwyxDLifgGhHknxg4qH1VJ5XZUCF0BOa40NoV4xUAp3jJ i+n9z1XukZkn3o+q/k81SllKXXIWvRk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684936429; a=rsa-sha256; cv=none; b=Dats56LEgsV3nb81/C8g+4SiXBp8uA4zFFwysIYJgkgP+HEzp7AIckvj7Cs+Qil0wrN1Zh 3/MYdJ7IusZoXnDn+Yx4dV2M7HOoCMi4Py14f35qpVzJXBVdmGJILcb7byi4nBElRKtYPm l++XTHBb8QrOHKG0GRc+SBaRUrKgqNU= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="Ikzq/7Dr"; spf=pass (imf09.hostedemail.com: domain of mtosatti@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=mtosatti@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684936428; 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=3/JE+/VA6wS2JR/X9eVdEeZwiqUU8bEuDrv3SbGQ10E=; b=Ikzq/7DrdDCcZDV4MY7h2jcZHQXXMN4GSXhkf7DjpQszXOBBMMqIKFGYermV9NZD+SNcDc BgiFRYlKEKrSYNvRJHnaD89d2zh7716FeYy5hr3RO/I1Bs/APxpzIZBoTT/p9Ts3YbiDCi TyUGgSNXIABU/KEgjWFUPkX2aMhOtyo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-197-93pexv7lOdW0qHkPt48qTg-1; Wed, 24 May 2023 09:53:45 -0400 X-MC-Unique: 93pexv7lOdW0qHkPt48qTg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 141C5802355; Wed, 24 May 2023 13:53:44 +0000 (UTC) Received: from tpad.localdomain (ovpn-112-2.gru2.redhat.com [10.97.112.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF1CE40C6EC4; Wed, 24 May 2023 13:53:43 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id EA382400DBEF5; Wed, 24 May 2023 10:53:23 -0300 (-03) Date: Wed, 24 May 2023 10:53:23 -0300 From: Marcelo Tosatti To: Michal Hocko Cc: Christoph Lameter , Aaron Tomlin , Frederic Weisbecker , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Russell King , Huacai Chen , Heiko Carstens , x86@kernel.org, Vlastimil Babka Subject: Re: [PATCH v8 00/13] fold per-CPU vmstats remotely Message-ID: References: <20230515180015.016409657@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Stat-Signature: 6f4bsrsrbxi9dhne94cikbjpfiqqu1nj X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 365A3140009 X-Rspam-User: X-HE-Tag: 1684936429-248878 X-HE-Meta: U2FsdGVkX18klmInW4Kid7rL2p8LbCxX3tuCEKK3PAg+HK5enjG9LaXYK8DXAOmlbyZkFjeNn5aD7zhvc0+2fkHcHR4iUoFSXeVysSvS481THAU/nRKu7GWE6UrpociL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ack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, May 24, 2023 at 02:51:55PM +0200, Michal Hocko wrote: > [Sorry for a late response but I was conferencing last two weeks and now > catching up] > > On Mon 15-05-23 15:00:15, Marcelo Tosatti wrote: > [...] > > v8 > > - Add summary of discussion on -v7 to cover letter > > Thanks this is very useful! This helps to frame the further discussion. > > I believe the most important question to answer is this in fact > > I think what needs to be done is to avoid new queue_work_on() > > users from being introduced in the tree (the number of > > existing ones is finite and can therefore be fixed). > > > > Agree with the criticism here, however, i can't see other > > options than the following: > > > > 1) Given an activity, which contains a sequence of instructions > > to execute on a CPU, to change the algorithm > > to execute that code remotely (therefore avoid interrupting a CPU), > > or to avoid the interruption somehow (which must be dealt with > > on a case-by-case basis). > > > > 2) To block that activity from happening in the first place, > > for the sites where it can be blocked (that return errors to > > userspace, for example). > > > > 3) Completly isolate the CPU from the kernel (off-line it). > > I agree that a reliable cpu isolation implementation needs to address > queue_work_on problem. And it has to do that _realiably_. This cannot by > achieved by an endless whack-a-mole and chasing each new instance. There > must be a more systematic approach. One way would be to change the > semantic of schedule_work_on and fail call for an isolated CPU. The > caller would have a way to fallback and handle the operation by other > means. E.g. vmstat could simply ignore folding pcp data because an > imprecision shouldn't really matter. Other callers might chose to do the > operation remotely. This is a lot of work, no doubt about that, but it > is a long term maintainable solution that doesn't give you new surprises > with any new released kernel. There are likely other remote interfaces > that would need to follow that scheme. > > If the cpu isolation is not planned to be worth that time investment > then I do not think it is also worth reducing a highly optimized vmstat > code. These stats are invoked from many hot paths and per-cpu > implementation has been optimized for that case. It is exactly the same code, but now with a "LOCK" prefix for CMPXCHG instruction. Which should not cost much due to cache locking (these are per-CPU variables anyway). > If your workload would > like to avoid that as disturbing then you already have a quiet_vmstat > precedence so find a way how to use it for your workload instead. > > -- > Michal Hocko > SUSE Labs OK so an alternative solution is to completly disable vmstat updates for isolated CPUs. Are you OK with that ?