Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp34563lqt; Thu, 18 Apr 2024 07:49:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW/cJ398O1W0inL5F9G3Ycar9r5i4ldm+/GiGhiOp5OTA9dVGtOMdE6V5oW4G2TtsAFMYKxKKd8pY3osAurnK6B+52DK3/oTC4EqKKMDA== X-Google-Smtp-Source: AGHT+IFgtaFO5dvKXhbCTOmfZc8mytE9n/CNGFo20jlCFq6zE+sKEF5EnoHi9xL1PDGDVPe5Rh9h X-Received: by 2002:a50:cd54:0:b0:56e:23e3:bdc2 with SMTP id d20-20020a50cd54000000b0056e23e3bdc2mr2475467edj.13.1713451779129; Thu, 18 Apr 2024 07:49:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713451779; cv=pass; d=google.com; s=arc-20160816; b=HmQTYY/WtSDrhT1PizRFAL6GIiC20sYCQALKRhRIUANq2LYz16Tajyt0HyV/9iz9bn srB3CBIREAD3pRYtNHJNTAzEnVP+TD3bDlYTOPGTPstdE40MoMvA9s4AMywLsh+EPSYn 8HI86mUbx7PjG3LZggfAW3CqVAKEfoUNvwb3nBRUKBtMR1KSMJxzx0vJjNNI0C6w0MNA iuoPoSzeHJvwzNLT/LFOY1EJw3xRgR3QTGVU4jb9CfAh0rnmPk3d8x4w8J2GfAfHSI3j PrcpHEfV9ZHfI6xKuYsP7nSmQcPfIV1GMQeMRU0Jt8RueYsY0fMH0wMb4XQt/w7o56xb rzRQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:date; bh=L+oZNHCiAYDQYgTy7C1ugxmdQ034rdJRx6SliQtfo3k=; fh=nGUocZvDufSpVLZTdzYjI8fXYMul0To4lCL4Uq3xcfw=; b=y6bY5peShqDNmle9VTTQ8HKePsENYzzv6f1qyLHRCe6DLEWN8OSvzGfYfJy3WP2qJQ 1lrwk5e13I+ybfM/p9P8Jr2YquQKRXYV2C5xH1NphMFuIolSUpSVC7fUxMtO6FHnTqCv HcSA2eVI6TsADYvq5v9g5MmN+HXJ15WNBSu4J235jEVkLVDyU69M9b6/BnW52iKii9Qd 1zKUxaNNIe1CwRmNcKA19HwofpUMWL7JGY6EecUlZQl+SwPFPkCEW3jt2eeZ5ofHkQDE ELmptD20W+AtxtgXDW/W19WpSteHAqH8nJmn0C8XEQjFImb/09eIZolYGugNKth3Pv5S OBvw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=iEARRixF; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-150335-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150335-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id r6-20020a50d686000000b0056df9749489si913775edi.651.2024.04.18.07.49.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 07:49:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-150335-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=iEARRixF; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-150335-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150335-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D78471F23AF2 for ; Thu, 18 Apr 2024 14:49:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F48716C43E; Thu, 18 Apr 2024 14:49:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="iEARRixF" Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 985EA16ABD8 for ; Thu, 18 Apr 2024 14:49:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713451755; cv=none; b=aeA3AUHw2IYSc0as2wM11pZ1E7ZjRsu88lMmBomFA5JRHuMPr2v78hOAO0ej/ARTTMdcq8L7lf/3f3gpJ9xPgj14ZW0vf3PbSPrL4d5HmN0akKqQyORWhM17BOTyQiN2pl0jejBa810gusf4RG89g8oqoKHaFTPdGNQeUCRXqok= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713451755; c=relaxed/simple; bh=P94DH8AqKAA5lye5i75LmkzjhoEdyTbF8tps1jGtw38=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GauqQiOSKQuERCZaz633WCRZXv08xAf98WidFfySEe041C4nxgVRxWtj0CJTN32ZQUYd6BimA/lJwvvHZEXJQ/SzBuXQ8tMtEb+Dy0vEbL0wkqrikj9TfZcTxKGC8BvulSanMP9sywSNdz3N8BOlWFwx7EcLjvZQdV3u/Nv3r0M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=iEARRixF; arc=none smtp.client-ip=95.215.58.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Thu, 18 Apr 2024 07:49:02 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1713451751; 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=L+oZNHCiAYDQYgTy7C1ugxmdQ034rdJRx6SliQtfo3k=; b=iEARRixFPb7tY694aPQ7hwwXPQqJZftXCopWiRG8K7LuZOlONNwzObwH4juZlvCU8THu3g hivCPVdZKszLw3dA047mPNFgYGE0J5Y2chC7EIdAfCoyR9ryDC++O/Q+t79Fn8O5v6p52F +WXAeQRqDuYsoq2y3t68OFrSNJUIJrQ= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Jesper Dangaard Brouer Cc: Yosry Ahmed , tj@kernel.org, hannes@cmpxchg.org, lizefan.x@bytedance.com, cgroups@vger.kernel.org, longman@redhat.com, netdev@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@cloudflare.com, Arnaldo Carvalho de Melo , Sebastian Andrzej Siewior , mhocko@kernel.org Subject: Re: [PATCH v1 2/3] cgroup/rstat: convert cgroup_rstat_lock back to mutex Message-ID: References: <171328983017.3930751.9484082608778623495.stgit@firesoul> <171328989335.3930751.3091577850420501533.stgit@firesoul> <651a52ac-b545-4b25-b82f-ad3a2a57bf69@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <651a52ac-b545-4b25-b82f-ad3a2a57bf69@kernel.org> X-Migadu-Flow: FLOW_OUT On Thu, Apr 18, 2024 at 11:02:06AM +0200, Jesper Dangaard Brouer wrote: > > > On 18/04/2024 04.19, Yosry Ahmed wrote: [...] > > > > I will keep the high-level conversation about using the mutex here in > > the cover letter thread, but I am wondering why we are keeping the > > lock dropping logic here with the mutex? > > > > I agree that yielding the mutex in the loop makes less sense. > Especially since the raw_spin_unlock_irqrestore(cpu_lock, flags) call > will be a preemption point for my softirq. But I kept it because, we > are running a CONFIG_PREEMPT_VOLUNTARY kernel, so I still worried that > there was no sched point for other userspace processes while holding the > mutex, but I don't fully know the sched implication when holding a mutex. > Are the softirqs you are interested in, raised from the same cpu or remote cpu? What about local_softirq_pending() check in addition to need_resched() and spin_needbreak() checks? If softirq can only be raised on local cpu then convert the spin_lock to non-irq one (Please correct me if I am wrong but on return from hard irq and not within bh or irq disabled spin_lock, the kernel will run the pending softirqs, right?). Did you get the chance to test these two changes or something similar in your prod environment?