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 E443BC433F5 for ; Fri, 10 Dec 2021 16:34:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5AE3C6B0072; Fri, 10 Dec 2021 11:34:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 55CF06B0073; Fri, 10 Dec 2021 11:34:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 44B186B0074; Fri, 10 Dec 2021 11:34:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 353CB6B0072 for ; Fri, 10 Dec 2021 11:34:49 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E3370180BE3A3 for ; Fri, 10 Dec 2021 16:34:38 +0000 (UTC) X-FDA: 78902433036.18.08E8905 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf18.hostedemail.com (Postfix) with ESMTP id A63961C0007 for ; Fri, 10 Dec 2021 16:34:35 +0000 (UTC) Date: Fri, 10 Dec 2021 17:34:33 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1639154074; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1optRwnSrbeTPq5hBXQ3ouIMBUA6Hs3VoxqW7Qdr5pQ=; b=cnZTbXRHb2RdvBl953YymNVlA/R/XwIkNnZFSBQV7xPgJQJi3k+Ts4wU56zs4hB6gN9Zx9 zkt/xK85on0ihLpz4acHhJ9xGDUBdYiugnCJEdkk6QsZOj4pG4+ilNS2U9+alljTlyrisS /F3LnJ6esbiYZPRMfzrY8Oj/jVgrjByGEsEAFQzC7+K5o/s6JlEgNnvzpdu1+NJtiCQyu/ kUAB6hG9mSPsbsymczRl189WujmmAsog42aw5+L1RWAx9TlF3JwXJ/Jc/ccjMJr2gWX7x6 NO0xIYJPypme254pSw/MVWnzfDx9GTXCG/uFfFvZOKvmO+2FU1IqjpgqRTuy+A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1639154074; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1optRwnSrbeTPq5hBXQ3ouIMBUA6Hs3VoxqW7Qdr5pQ=; b=F1qbHzysXR9EGrBloIho2z2ExfYszOTiOtQNVU/EQ3u+tFM7ZODd5S9xeyggKtrxBYYpZP 9AMc1tMvD1ujHmDw== From: Sebastian Andrzej Siewior To: Waiman Long Cc: Johannes Weiner , Michal Hocko , Vladimir Davydov , Andrew Morton , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Thomas Gleixner , Peter Zijlstra Subject: Re: [PATCH-next v2] mm/memcg: Properly handle memcg_stock access for PREEMPT_RT Message-ID: References: <20211210025228.158196-1-longman@redhat.com> <80ee87bb-f36c-4a16-9095-43ea84818375@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <80ee87bb-f36c-4a16-9095-43ea84818375@redhat.com> X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: A63961C0007 X-Stat-Signature: hwf3mkygdw8qefkq34kjqiw71gz4fsdp Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=cnZTbXRH; dkim=pass header.d=linutronix.de header.s=2020e header.b=F1qbHzys; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf18.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de X-HE-Tag: 1639154075-566776 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 2021-12-10 11:29:31 [-0500], Waiman Long wrote: >=20 > On 12/10/21 08:01, Sebastian Andrzej Siewior wrote: > > On 2021-12-09 21:52:28 [-0500], Waiman Long wrote: > > =E2=80=A6 > > > --- a/mm/memcontrol.c > > > +++ b/mm/memcontrol.c > > =E2=80=A6 > > > @@ -2210,7 +2211,7 @@ static void refill_stock(struct mem_cgroup *mem= cg, unsigned int nr_pages) > > > struct memcg_stock_pcp *stock; > > > unsigned long flags; > > > - local_irq_save(flags); > > > + local_lock_irqsave(&memcg_stock.lock, flags); > > Why is this one using the lock? It isn't accessing irq_obj, right? > Well, the lock isn't just for irq_obj. It protects the whole memcg_stock > structure which include irq_obj. Sometimes, data in irq_obj (or task_obj) > will get transfer to nr_pages and vice versa. So it is easier to use one > single lock for the whole thing. This needs way better documentation what protects what any why. I don't like the quick slapping for RT only usage without any kind of explanation. Once you think you know it is irq_obj only you end up here where you have the lock again for no obvious reason. >=20 > Cheers, > Longman Sebastian