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 69EA4C433F5 for ; Thu, 17 Feb 2022 09:29:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DDF906B0071; Thu, 17 Feb 2022 04:29:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D683F6B0075; Thu, 17 Feb 2022 04:29:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C08BF6B0078; Thu, 17 Feb 2022 04:29:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0026.hostedemail.com [216.40.44.26]) by kanga.kvack.org (Postfix) with ESMTP id AE7D86B0071 for ; Thu, 17 Feb 2022 04:29:02 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 6877F180AC359 for ; Thu, 17 Feb 2022 09:29:02 +0000 (UTC) X-FDA: 79151747724.12.A67200F Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf09.hostedemail.com (Postfix) with ESMTP id 9BBB3140006 for ; Thu, 17 Feb 2022 09:29:01 +0000 (UTC) Date: Thu, 17 Feb 2022 10:28:57 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1645090139; 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=Rfvk1TOpsNNoE1/dc+0M3aPmjLaMlI/s+kkO3n5aMnQ=; b=ahyvfRlUu+y1KuuXpCSjq/hC1mJ3pNLNUyJvxv/xP4hYG6KeYo59Dj4gUndCvKWWUZdF1p EPzoK4ASLFCn3+4Zbgqv9k2m9pMI1ajmY/+SpyTonH2vfz2jhWTGg15JeT462vIjsHFsAH BWBV7oTuNRfvO7mEyPsLBiHrsmDPHidirIJ8JL0BYVl/POyR06dg+XdIFquu17PHBqhOch Lny7nvsdX2Flzu4avyejdflrLAuzTqBfDXP4/4weyxp0TgXrMneEkreuzdiL+7zVbbDt2e k/iO/2mDhnWgOEglvVuWk6b14ZNS4BgvV9SVMkAYaeVtlZmx0fiNCnhh6gSSNg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1645090139; 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=Rfvk1TOpsNNoE1/dc+0M3aPmjLaMlI/s+kkO3n5aMnQ=; b=i+s1ymebTXcUUlUub/3iQBKh1aNTNiyfZAF8JndxUG78GwiZI+oPjOskJmV/LT8enJ8XXZ sU3FfP1KL5y5AHBg== From: Sebastian Andrzej Siewior To: Johannes Weiner Cc: cgroups@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Michal Hocko , Michal =?utf-8?Q?Koutn=C3=BD?= , Peter Zijlstra , Thomas Gleixner , Vladimir Davydov , Waiman Long , kernel test robot Subject: Re: [PATCH v2 4/4] mm/memcg: Protect memcg_stock with a local_lock_t Message-ID: References: <20220211223537.2175879-1-bigeasy@linutronix.de> <20220211223537.2175879-5-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 9BBB3140006 X-Rspam-User: Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=ahyvfRlU; dkim=pass header.d=linutronix.de header.s=2020e header.b=i+s1ymeb; spf=pass (imf09.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de X-Stat-Signature: etkaih9acni81whqi4tkbp1rgrwh44kz X-Rspamd-Server: rspam11 X-HE-Tag: 1645090141-397414 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 2022-02-16 13:08:55 [-0500], Johannes Weiner wrote: > I thought you'd fold it into yours, but separate patch works too, > thanks! > > Signed-off-by: Johannes Weiner Thank you. > One important note, though: > > > @@ -3151,8 +3155,17 @@ static void drain_obj_stock(struct memcg_stock_pcp *stock) > > unsigned int nr_pages = stock->nr_bytes >> PAGE_SHIFT; > > unsigned int nr_bytes = stock->nr_bytes & (PAGE_SIZE - 1); > > > > - if (nr_pages) > > - obj_cgroup_uncharge_pages(old, nr_pages); > > + if (nr_pages) { > > + struct mem_cgroup *memcg; > > + > > + memcg = get_mem_cgroup_from_objcg(old); > > + > > + if (!cgroup_subsys_on_dfl(memory_cgrp_subsys)) > > + page_counter_uncharge(&memcg->kmem, nr_pages); > > + __refill_stock(memcg, nr_pages); > > This doesn't take "memcg: add per-memcg total kernel memory stat" > queued in -mm into account and so will break kmem accounting. > > Make sure to rebase the patches to the -mm tree before sending it > out. You can find it here: https://github.com/hnaz/linux-mm Thank you, rebased on-top. Sebastian From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Andrzej Siewior Subject: Re: [PATCH v2 4/4] mm/memcg: Protect memcg_stock with a local_lock_t Date: Thu, 17 Feb 2022 10:28:57 +0100 Message-ID: References: <20220211223537.2175879-1-bigeasy@linutronix.de> <20220211223537.2175879-5-bigeasy@linutronix.de> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1645090139; 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=Rfvk1TOpsNNoE1/dc+0M3aPmjLaMlI/s+kkO3n5aMnQ=; b=ahyvfRlUu+y1KuuXpCSjq/hC1mJ3pNLNUyJvxv/xP4hYG6KeYo59Dj4gUndCvKWWUZdF1p EPzoK4ASLFCn3+4Zbgqv9k2m9pMI1ajmY/+SpyTonH2vfz2jhWTGg15JeT462vIjsHFsAH BWBV7oTuNRfvO7mEyPsLBiHrsmDPHidirIJ8JL0BYVl/POyR06dg+XdIFquu17PHBqhOch Lny7nvsdX2Flzu4avyejdflrLAuzTqBfDXP4/4weyxp0TgXrMneEkreuzdiL+7zVbbDt2e k/iO/2mDhnWgOEglvVuWk6b14ZNS4BgvV9SVMkAYaeVtlZmx0fiNCnhh6gSSNg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1645090139; 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=Rfvk1TOpsNNoE1/dc+0M3aPmjLaMlI/s+kkO3n5aMnQ=; b=i+s1ymebTXcUUlUub/3iQBKh1aNTNiyfZAF8JndxUG78GwiZI+oPjOskJmV/LT8enJ8XXZ sU3FfP1KL5y5AHBg== Content-Disposition: inline In-Reply-To: List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Johannes Weiner Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, Andrew Morton , Michal Hocko , Michal =?utf-8?Q?Koutn=C3=BD?= , Peter Zijlstra , Thomas Gleixner , Vladimir Davydov , Waiman Long , kernel test robot On 2022-02-16 13:08:55 [-0500], Johannes Weiner wrote: > I thought you'd fold it into yours, but separate patch works too, > thanks! > > Signed-off-by: Johannes Weiner Thank you. > One important note, though: > > > @@ -3151,8 +3155,17 @@ static void drain_obj_stock(struct memcg_stock_pcp *stock) > > unsigned int nr_pages = stock->nr_bytes >> PAGE_SHIFT; > > unsigned int nr_bytes = stock->nr_bytes & (PAGE_SIZE - 1); > > > > - if (nr_pages) > > - obj_cgroup_uncharge_pages(old, nr_pages); > > + if (nr_pages) { > > + struct mem_cgroup *memcg; > > + > > + memcg = get_mem_cgroup_from_objcg(old); > > + > > + if (!cgroup_subsys_on_dfl(memory_cgrp_subsys)) > > + page_counter_uncharge(&memcg->kmem, nr_pages); > > + __refill_stock(memcg, nr_pages); > > This doesn't take "memcg: add per-memcg total kernel memory stat" > queued in -mm into account and so will break kmem accounting. > > Make sure to rebase the patches to the -mm tree before sending it > out. You can find it here: https://github.com/hnaz/linux-mm Thank you, rebased on-top. Sebastian