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 C3625C433EF for ; Thu, 23 Dec 2021 02:31:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E8C9D6B0072; Wed, 22 Dec 2021 21:31:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E3AF86B0073; Wed, 22 Dec 2021 21:31:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D02B06B0074; Wed, 22 Dec 2021 21:31:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0186.hostedemail.com [216.40.44.186]) by kanga.kvack.org (Postfix) with ESMTP id C14966B0072 for ; Wed, 22 Dec 2021 21:31:47 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 6AD98181AC9C6 for ; Thu, 23 Dec 2021 02:31:47 +0000 (UTC) X-FDA: 78947483454.29.AADA88B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf25.hostedemail.com (Postfix) with ESMTP id C95B0A001B for ; Thu, 23 Dec 2021 02:31:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640226705; 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=ndDsEl87XhT/7c03RwGZ3BUnuqirZACHRsfL75QimI4=; b=Olqr226EQK6E9dmK9O5BDN+/+apBwlNYe9p4uKPoVcQrMCPTjnbDOatxH73pY2cexTidfB sKS2Wi9YZE7XDMGfWZtIh24vpL4MMiB09pMU1NABfEsPoCmyFFfrOg8RJFrY7TmCFZEBar Yt9vuBwim1p85cZ2JNQX393oaW15tx4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-37-YRiRbPuwOMiy_ppxWk5ANg-1; Wed, 22 Dec 2021 21:31:40 -0500 X-MC-Unique: YRiRbPuwOMiy_ppxWk5ANg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 34EA9802C91; Thu, 23 Dec 2021 02:31:38 +0000 (UTC) Received: from [10.22.16.38] (unknown [10.22.16.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED5337EF56; Thu, 23 Dec 2021 02:31:36 +0000 (UTC) Message-ID: Date: Wed, 22 Dec 2021 21:31:36 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: [RFC PATCH 1/3] mm/memcg: Protect per-CPU counter by disabling preemption on PREEMPT_RT Content-Language: en-US To: Sebastian Andrzej Siewior , cgroups@vger.kernel.org, linux-mm@kvack.org Cc: Johannes Weiner , Michal Hocko , Vladimir Davydov , Andrew Morton , Thomas Gleixner , Peter Zijlstra References: <20211222114111.2206248-1-bigeasy@linutronix.de> <20211222114111.2206248-2-bigeasy@linutronix.de> From: Waiman Long In-Reply-To: <20211222114111.2206248-2-bigeasy@linutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Stat-Signature: dadg8p8t74krn8wuqsjq73b6uzdy3ybw X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: C95B0A001B Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Olqr226E; spf=none (imf25.hostedemail.com: domain of longman@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=longman@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1640226696-685994 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 12/22/21 06:41, Sebastian Andrzej Siewior wrote: > The per-CPU counter are modified with the non-atomic modifier. The > consistency is ensure by disabling interrupts for the update. > This breaks on PREEMPT_RT because some sections additionally > acquire a spinlock_t lock (which becomes sleeping and must not be > acquired with disabled interrupts). Another problem is that > mem_cgroup_swapout() expects to be invoked with disabled interrupts > because the caller has to acquire a spinlock_t which is acquired with > disabled interrupts. Since spinlock_t never disables interrupts on > PREEMPT_RT the interrupts are never disabled at this point. > > The code is never called from in_irq() context on PREEMPT_RT therefore How do you guarantee that these percpu update functions won't be called in in_irq() context for PREEMPT_RT? Do you think we should add a WARN_ON_ONCE(in_irq()) just to be sure? Cheers, Longman