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 3E96DC636D3 for ; Mon, 6 Feb 2023 19:11:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9DE666B0072; Mon, 6 Feb 2023 14:11:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 98EA56B0073; Mon, 6 Feb 2023 14:11:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8567B6B0074; Mon, 6 Feb 2023 14:11:07 -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 7240B6B0072 for ; Mon, 6 Feb 2023 14:11:07 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 4446C1603E1 for ; Mon, 6 Feb 2023 19:11:07 +0000 (UTC) X-FDA: 80437809774.24.5174EAB Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf16.hostedemail.com (Postfix) with ESMTP id 2D668180022 for ; Mon, 6 Feb 2023 19:11:05 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NNLeeMTe; spf=pass (imf16.hostedemail.com: domain of mtosatti@redhat.com designates 170.10.133.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=1675710665; 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=2gzFi5JB/wsVMdtsyVlJ8PrVrHAH1wodhHHtJ2DK0as=; b=WEp/Om03nSavimxX5TwCa0qT/uVW0Cj1Fc19nZm4jRhBoPoXNnyUgoFyPFr/Iq2WjNhxYc IHnvrNUDGbbErNcOG1R/GPo/d789/myACz1Y8IkgPPurnbIYzYbu/vtYZlwc/RnzDkMBKd JeQjo4rQQJgOj754zcBglcFLt5XnwoY= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NNLeeMTe; spf=pass (imf16.hostedemail.com: domain of mtosatti@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=mtosatti@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675710665; a=rsa-sha256; cv=none; b=pjOjyuUD1jZMPJ3JoUE1PP8XUISW2EnTIdMtDTTL63OmjSkFZBiMkVB31/RkeVEelEAN7O 3PUz0LYpHsHnnsYylRgWhPLBqC5ZFIB+49JdNKnGvjvO6tkMpmfzawaPyTyGp/yV4tMogF 9Ty1ZiURx6ABABVQqhqN1QY7zTwhvTk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675710664; 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=2gzFi5JB/wsVMdtsyVlJ8PrVrHAH1wodhHHtJ2DK0as=; b=NNLeeMTeXJvquj5gwVJzhYJ8c3IqQV/yhQoi1gvWRaAf6fdv5/um02E5Dx903yusf5gaJF ZKg0sAYkOLSBrmP4PBOacbPk5KUC4TK6WAGEGeNmjCd2VIWTjYFPwCiW/miKYblmqU4gQv dCGEEzRVJTEfTaMHK9bblqr/c+8bHZA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-572-EynxCIuhMZS3meSWiy84WQ-1; Mon, 06 Feb 2023 14:11:00 -0500 X-MC-Unique: EynxCIuhMZS3meSWiy84WQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 65BED3806620; Mon, 6 Feb 2023 19:11:00 +0000 (UTC) Received: from tpad.localdomain (ovpn-112-3.gru2.redhat.com [10.97.112.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 32742492B21; Mon, 6 Feb 2023 19:11:00 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id 134EF403FCA00; Mon, 6 Feb 2023 16:10:33 -0300 (-03) Date: Mon, 6 Feb 2023 16:10:33 -0300 From: Marcelo Tosatti To: Christoph Lameter Cc: Aaron Tomlin , Frederic Weisbecker , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 3/5] mm/vmstat: use cmpxchg loop in cpu_vm_stats_fold Message-ID: References: <20230201195013.881721887@redhat.com> <20230201195104.460373427@redhat.com> <5615572-974e-74cc-6c34-1de618b777cf@gentwo.de> <47a289f0-ae96-e0e6-c579-70ec61fff384@gentwo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <47a289f0-ae96-e0e6-c579-70ec61fff384@gentwo.de> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: nd38f7bxh9zz4sqyyawwfft7q3csy566 X-Rspamd-Queue-Id: 2D668180022 X-HE-Tag: 1675710665-109401 X-HE-Meta: U2FsdGVkX1/FuXJ7EL2yBFPauezrX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DaZKkJKBvYyL6gMe2ZSkPDY2cKjrdB13A20qDnA+YG2A6tf8Y86lbgfr7Gb4cWHV1nIlSR95DlMZuhYscWeJ4lswXpsOYjhbg1HghCwxMmNNheFB/ub8pMyENpidx2S3j8Ba/Uz2Eq8Cybg== 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, Feb 06, 2023 at 10:42:46AM +0100, Christoph Lameter wrote: > On Fri, 3 Feb 2023, Marcelo Tosatti wrote: > > > > Isnt there some lock/serializtion to stall the kernel until you are done? > > > > Not that i know of. Anyway, an additional datapoint is: > > > > "Software defined PLC" > > (https://www.redhat.com/en/blog/software-defined-programmable-logic-controller-introduction), > > applications > > can perform system calls in their time sensitive loop. > > > > One example of an opensource software is OpenPLC. > > > > One would like to avoid interruptions for those cases as well. > > Well allowing sytem calls during "time sensitiveness" implies > it is not that sensitive to vmstat updates > which have a smaller impact than system calls. Not necessarily. Certain system calls won't touch per-CPU vmstats: nanosleep, for example. Perhaps i misunderstood your suggestion: So the patchset in discussion uses (or should use, in v2), in both vmstat_shepherd and vmstat counter modification, LOCK CMPXCHG. There is the potential that LOCK CMPXCHG, from vmstat counter modification, incurs a performance degradation. Note however, that cachelocking should hopefully "hide" the costs. Do you have any concerns about this patchset other than the performance degradation due to addition of LOCK in CMPXCHG? The other possible concern is that the preempt-disabled functions, namely: __inc_node_page_state, __dec_node_page_state, __mod_node_page_state, __inc_zone_page_state, __dec_zone_page_state, __mod_zone_page_state have been switched to cmpxchg loop. Is that a problem? Would expect that measuring LOCK CMPXCHG does not incur significant performance degradation as compared to CMPXCHG (from the page allocation benchmark) would address your concerns? Thanks