Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2675778lqb; Tue, 28 May 2024 07:14:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXJuzUDdCyqIPrUo/ODHHZqZ5Ayzz7yuB7bFne04Tuyg3NEB64/uj6lvvBiNe8jTNfz51M4UCn0FkLVHP/Bmx4mhiHETNDW8X5RHvSR6w== X-Google-Smtp-Source: AGHT+IE9ht/wS576Iqdmg84Bj2d/73dmQAVu/fcBD4+sOdmAQNcAOyZsBCjJnEjpuVImg2zdVFnG X-Received: by 2002:a05:6a00:27a9:b0:6f3:eaa2:53a0 with SMTP id d2e1a72fcca58-6f8f3e7e88dmr12858943b3a.24.1716905657937; Tue, 28 May 2024 07:14:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716905657; cv=pass; d=google.com; s=arc-20160816; b=EBRZWRJWIQdsS/YDJHao0rEnFv4A+2SPDzdRfjl7c3XgwwcjNSkBtilAvD40WTMGn6 jIi3zUkC9CP/nPLrTHXmYX65GuhCT4Rda4Z6VWukoKxWxLuT94GB7n3vZPNngbw8/X5C LYofMHNlhwtMBlayC+o4xb2QhNTXSP6nQHczvKgs8o4PmJoROXSmkxH86V7PmnRb7ydg YAd+GBCoFVWzgmKka6lU8NWmHeTB760P4pFDJWg6ctFXXE/FPed92bfOFFM5qx0frWfY Vfn5HiHhrVTa+rMpFhG6vQGCFwX3vzQtxgjlS6x8xCbCCRPN8r6spV4/VI/sNIvtwFuJ 1u0A== 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:dkim-signature:date; bh=vTOgAjTKulp1YcH/LU4x95O4AvhUBSt+M3+DMT8WODI=; fh=GmvVFmSVaaiEuQnyL4keyQ9LIblNua/mtQPfXZT4Mh4=; b=voCu+WFhATKO7sxoEMV2BS3r4W4ozjTHl8fDA9e4bJziABd43G84NG7jRb48tRFDnI IjxNp4XLNMk3buSlXQ2+kBzew0U6nClOSHvo7xvYQU/tQFnDQXqqkCcLP+CuSGrW+F5Y xW2A7V8lDojD5pHdtwYfGmQdYDO2PsK33fa+dgHUjMPjpPMBLiEErWEbybyCZ9yRjv2r EfWLSc9AXPtRXzMsRVW0OkjtiyYmoH5rWf9imTT8Yf6cm5+rV9oOu4uSHTsv4ddt5Qw1 cb10lyvZziBsxRlQFVFkXFRCOwM+8jeLtkqEeQbOyL6SOelOsAxkU0kfaQP0m6D+xkSH n54A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=wFSLxzoB; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-192503-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192503-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f8fcfd7f8csi8249315b3a.189.2024.05.28.07.14.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 07:14:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192503-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=wFSLxzoB; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-192503-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192503-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F30C8285C3B for ; Tue, 28 May 2024 14:14:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8587F16F8E7; Tue, 28 May 2024 14:13:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="wFSLxzoB"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="QP/pyYu1" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 163A716FF33 for ; Tue, 28 May 2024 14:13:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716905626; cv=none; b=Pk25nPc7kQm0M//atc8+2BDkZAX7qR/Bx8cPStbbkatWs8eiqe8d8nGBAoqTQvWaxmTCpbbQvpTHZQ4+9j+O4KPi/nDtzxH3iHWkPSVqnw8JePMyfuhUoLmwH0094Anlv0lgj53VZOwuNv/gkRBRlstBrg24B5C2TQ3ri4OcPr8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716905626; c=relaxed/simple; bh=yGczwoowHgTBSzvC13wg6toyMlplKlmFcpHOKWv7Wrc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NejbjtZjEIDZkSc5A/e7ceH5f+ufhTE/3ss4ySwhgYg5JRW7zpKH9TCxF18q05+Qrq539NTQlqjaM19HM3ZczVKNxYSuiSqezmKNnv8E0EkBeJfiqpcOGXAofGLsM+2ynTTxK+lAcMiG5q8QNhUuxSPkAJjr0b6xOUyauikICtE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=wFSLxzoB; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=QP/pyYu1; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Tue, 28 May 2024 16:13:41 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1716905623; 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=vTOgAjTKulp1YcH/LU4x95O4AvhUBSt+M3+DMT8WODI=; b=wFSLxzoBVfwAtCCftNneGnf1GCgI3etrzLApZhe+KVi6LYCS0Bh+V0msc0WPKEkanbNa+W WY8YiyKsCYMHgB9o8sSwPjki7Yc83Vd+kt0HwL6xw7BvzlDBru09I6gRkXwfEB8IumYjy/ 4hYOlMRkS4Q/f6P6xZTboAWt1bNKZ+hES9s+VkuKNi1blqLJoNnIuh8KLOOKzqlXpNwnV0 rGVxkaoNcXIHFo8J+/WvBAgx2FlzcoL7I/Cejd6Sm6hISTvFGcrFFFYkesIVKF6cLTyncq HEF1e1ecx3U9UgqxfogtdrjiGM9PAXRy1g7pHXiCEF/JhXXN1+LZAA2Yssacyg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1716905623; 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=vTOgAjTKulp1YcH/LU4x95O4AvhUBSt+M3+DMT8WODI=; b=QP/pyYu1WTVN5VEjvoSr5awhkcFfSSc5ke5CgQ2wgvJ0vcdgW3vJKZQHLQPBKMm/rqjHlL PRb86YH1xWGdHRAA== From: Sebastian Andrzej Siewior To: "Vlastimil Babka (SUSE)" Cc: Shakeel Butt , Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Thomas Gleixner Subject: [PATCH v2] memcg: Remove the lockdep assert from __mod_objcg_mlstate(). Message-ID: <20240528141341.rz_rytN_@linutronix.de> References: <20240528121928.i-Gu7Jvg@linutronix.de> <09e085bb-f09e-4901-a2dd-a0b789bb8a4d@kernel.org> <20240528134027.OxDASsS3@linutronix.de> 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=utf-8 Content-Disposition: inline In-Reply-To: The assert was introduced in the commit cited below as an insurance that the semantic is the same after the local_irq_save() has been removed and the function has been made static. The original requirement to disable interrupt was due the modification of per-CPU counters which require interrupts to be disabled because the counter update operation is not atomic and some of the counters are updated from interrupt context. All callers of __mod_objcg_mlstate() acquire a lock (memcg_stock.stock_lock) which disables interrupts on !PREEMPT_RT and the lockdep assert is satisfied. On PREEMPT_RT the interrupts are not disabled and the assert triggers. The safety of the counter update is already ensured by VM_WARN_ON_IRQS_ENABLED() which is part of __mod_memcg_lruvec_state() and does not require yet another check. Remove the lockdep assert from __mod_objcg_mlstate(). Fixes: 91882c1617c15 ("memcg: simple cleanup of stats update functions") Link: https://lore.kernel.org/r/20240528121928.i-Gu7Jvg@linutronix.de Signed-off-by: Sebastian Andrzej Siewior --- On 2024-05-28 15:44:51 [+0200], Vlastimil Babka (SUSE) wrote: > I think just s/memcg_stats_lock()/__mod_memcg_lruvec_state()/ in your > phrasing, since we are removing the lockdep assert from path that calls > __mod_memcg_lruvec_state() and not memcg_stats_lock()? > Or am I missing something? Yeah, makes sense. mm/memcontrol.c | 2 -- 1 file changed, 2 deletions(-) --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3147,8 +3147,6 @@ static inline void __mod_objcg_mlstate(s struct mem_cgroup *memcg; struct lruvec *lruvec; - lockdep_assert_irqs_disabled(); - rcu_read_lock(); memcg = obj_cgroup_memcg(objcg); lruvec = mem_cgroup_lruvec(memcg, pgdat);