Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5751001rwd; Wed, 24 May 2023 06:23:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Qma2iXdDI/QkZV7XWnZibaBCpw1tTnRD1Aha4LwBfxsbhrUnLV+S6gcL0bj5glJQHbKyj X-Received: by 2002:a17:902:e5ce:b0:1a2:a904:c42e with SMTP id u14-20020a170902e5ce00b001a2a904c42emr20366155plf.24.1684934583136; Wed, 24 May 2023 06:23:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684934583; cv=none; d=google.com; s=arc-20160816; b=ce1wjJwls7Dp/IfNs9OkEoPunYDufY7feakxU4WuLBsHNYSvrRweg8isW7Fms+zLK7 3D7lGBHwKm2p2zEFx3GZIRLCuo9fvzjNDHHgpRgHfgZDSjooXw/saE1xud+N05K4Kioq iQ/LXFQvcJebRul72PCJErwl3Hmq20O+VZT3LFYtJipGcUjMOXr+B6GquDG6c0qBwXcC RszvHizzbQ3Hf4zeFHObvXrhlpasrLQeeROsf7o6U8VOFfSzdCbtK0c3//qeZnBMeWNX fwFpR4jhZz8xR/By8ADgRvrbFD5TvdU93kG7JevIEbWfXlBPgo3BOlSikaMydZr+5k7z e48g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=N/gy0k3e794wotWy75Qhs+8/ZV46Dj45SDKUp9pn8Rc=; b=C2fuKpf0C0HMs6yfMiT4AWWqIjfCXsOs1wLMDOtEo8f687USidPLd4HKikFwajZ2Y/ dcLgBXPV+8fCdGQwo4HGBNnxtmppDVnZ8CAWTSEqibOVPLIIz1iJ5m2x6GrmqTV76zM7 fKC/MbpEfACcoHcx/aWv1iO+G0nAFW+HHfa4nCzn+ppbl6AY+jwL4zedH2KrddkDuxtq LtKDGGIIx4MWUjabWFt+w5N+TQYHSFWGd/jKjpviL6bL4GSVpUlmi0YjUrhCYsjr8ukO 9ut7RRBdyO6Dr91OpLfZ6XuQ3uKkiuG3YipX8EguQ3UPZSEMGsWCJm/1BYhb3ZwT0Fe4 jCiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=m7WrSXyU; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bi10-20020a170902bf0a00b001a6e719421asi7819767plb.366.2023.05.24.06.22.41; Wed, 24 May 2023 06:23:03 -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=@suse.com header.s=susede1 header.b=m7WrSXyU; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233886AbjEXMwI (ORCPT + 99 others); Wed, 24 May 2023 08:52:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232046AbjEXMwH (ORCPT ); Wed, 24 May 2023 08:52:07 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 221CBB0 for ; Wed, 24 May 2023 05:51:57 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id AD4A0221F4; Wed, 24 May 2023 12:51:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1684932716; h=from:from:reply-to: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=N/gy0k3e794wotWy75Qhs+8/ZV46Dj45SDKUp9pn8Rc=; b=m7WrSXyUialsi0sAVP4s1PWnGSWrhOkeY+NmvcKtrk3dY24FjdIM6DrsG3xbL8RLEUnTNf sKKuvWguR3MUViMwdNUOQtYriJaKmyoJdGQTwOX4rR99v2jtl5c9HGo8aJNeeC/H2GTNPp AAOw4xQDbkYFmV0iEIQKNtDZGgUeWf4= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8FD88133E6; Wed, 24 May 2023 12:51:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id a+zlIGwIbmQVdAAAMHmgww (envelope-from ); Wed, 24 May 2023 12:51:56 +0000 Date: Wed, 24 May 2023 14:51:55 +0200 From: Michal Hocko To: Marcelo Tosatti 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: <20230515180015.016409657@redhat.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 [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. 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