Message ID | 20230125073502.743446-6-leobras@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 99F2DC27C76 for <linux-mm@archiver.kernel.org>; Wed, 25 Jan 2023 07:36:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 301A06B007D; Wed, 25 Jan 2023 02:36:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B4136B007E; Wed, 25 Jan 2023 02:36:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 153956B0080; Wed, 25 Jan 2023 02:36:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 049846B007D for <linux-mm@kvack.org>; Wed, 25 Jan 2023 02:36:19 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D0D03A0742 for <linux-mm@kvack.org>; Wed, 25 Jan 2023 07:36:18 +0000 (UTC) X-FDA: 80392513236.29.84CFFFA Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf05.hostedemail.com (Postfix) with ESMTP id C8BCE100009 for <linux-mm@kvack.org>; Wed, 25 Jan 2023 07:36:16 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=T2omN7L1; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf05.hostedemail.com: domain of leobras@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=leobras@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674632176; h=from:from:sender: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:dkim-signature; bh=NWp8AY96vdXmiMbopROrFgs2cU/VADiUd7iIJJXBCxY=; b=MeDHeGzk8hELqtW8vYc9TBHGS2J9TYJOORVJdnkvLYb8dccU/iq17qSjYHTvsXFTTvKHTE 2ShApHQsSmMQUvZcINN5LWevEnE84Y99RdUNjog3a5pZyhBFxH30mXs7rWwgrZGonI6Cxn SvPwJuujQ0bodLgfo9vVPKSv9vua2ok= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=T2omN7L1; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf05.hostedemail.com: domain of leobras@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=leobras@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674632176; a=rsa-sha256; cv=none; b=6TFMqFPgntOsMApFGof4wa3+Ezwn+NqFQ2hrvg3jLf2aL/9Q/u2/auqUPkk9gfFT3tumt6 IxH91Unc9kAOWQ63Y1cMxMmhV0g9IMhOrInXkLYp9lbxQ0vQ+OHd5TCygbHGhoGuPNoyXS BKv2w6gf162tQLmsw7bYqE0b9LVLHE0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674632176; 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=NWp8AY96vdXmiMbopROrFgs2cU/VADiUd7iIJJXBCxY=; b=T2omN7L1w1tR17xqH0l0c1D8Q4TUgVs1DahEWa2hT13FSHuVJxPAatSHpztQhVvkEjzM0u Z0X7kPTDAW2VacAi/YdlhP+jbaYqfrP+YJxZP3MVFze2KYZ1QOGDcvsE77gxWylCEJ48QV /WbqOOGnGF3v8Lvqn9wY+hdU0IohzC4= Received: from mail-oi1-f198.google.com (mail-oi1-f198.google.com [209.85.167.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-278-Ef7YekK2MpKblw2zrgAbyQ-1; Wed, 25 Jan 2023 02:36:10 -0500 X-MC-Unique: Ef7YekK2MpKblw2zrgAbyQ-1 Received: by mail-oi1-f198.google.com with SMTP id t25-20020a056808159900b0035ecfd3fa78so5506492oiw.4 for <linux-mm@kvack.org>; Tue, 24 Jan 2023 23:36:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NWp8AY96vdXmiMbopROrFgs2cU/VADiUd7iIJJXBCxY=; b=M+HJPkT/G1Dty8jZys9B0mq7FT/uwq35GTW1fvdpyxO68NHB9xHJJhsyw63jaNJdIq IZqZqCwCSjyZqWv232mlzvaZdaEO9gwgQItprMzg5oNVtUj8IhwiVPhu27ShH4u2Suk9 vCifTaJe7chc12KwoqlagU3eDDczZgWUgV8qkHhFYHAShkyjzZy0+BaR049Vsxzi+Ghm h+LwhzeD+1WOGqFdLTvpy3RDnFfLex2tUO/PN/I1PajIAZBsyHpLr/WF+zGh2DXNGti0 cBI4l8CqmxXKV9Angb50qwJuN5OCmLLCb/L5CXrZhdRJwAfhGrrD6avRa1dTUiUoQ6vX vVyg== X-Gm-Message-State: AFqh2kryqL628C+OBvPI2HykEnw4dFquCgZjIr+i33+IafqlIcPbDrbE RPvAAqXImxVm7U43mqlKJJJu7GZMS0IaJX5VZjf48b8Kf9+LfQLlxxUeFQKiCqA34xzQhkrAFjW l0xW0BRilSn0= X-Received: by 2002:a05:6870:e0ce:b0:15f:3bb9:7b3d with SMTP id a14-20020a056870e0ce00b0015f3bb97b3dmr17462985oab.28.1674632169341; Tue, 24 Jan 2023 23:36:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXv6r5ehrqKjuOqxpudgJdHfNcykat5kT9ZAeiiKrUzWSSAJYK3YalJM5sJ2WYW3DmqLUhiPTw== X-Received: by 2002:a05:6870:e0ce:b0:15f:3bb9:7b3d with SMTP id a14-20020a056870e0ce00b0015f3bb97b3dmr17462978oab.28.1674632169128; Tue, 24 Jan 2023 23:36:09 -0800 (PST) Received: from LeoBras.redhat.com ([2804:1b3:a800:14fa:9361:c141:6c70:c877]) by smtp.gmail.com with ESMTPSA id x189-20020a4a41c6000000b0050dc79bb80esm1538802ooa.27.2023.01.24.23.36.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 23:36:08 -0800 (PST) From: Leonardo Bras <leobras@redhat.com> To: Johannes Weiner <hannes@cmpxchg.org>, Michal Hocko <mhocko@kernel.org>, Roman Gushchin <roman.gushchin@linux.dev>, Shakeel Butt <shakeelb@google.com>, Muchun Song <muchun.song@linux.dev>, Andrew Morton <akpm@linux-foundation.org>, Marcelo Tosatti <mtosatti@redhat.com> Cc: Leonardo Bras <leobras@redhat.com>, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/5] mm/memcontrol: Remove flags from memcg_stock_pcp Date: Wed, 25 Jan 2023 04:35:02 -0300 Message-Id: <20230125073502.743446-6-leobras@redhat.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125073502.743446-1-leobras@redhat.com> References: <20230125073502.743446-1-leobras@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Rspamd-Queue-Id: C8BCE100009 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature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vxHauPKlH24T7F8b5c7RPm8AahWIKEzz0DBQPFa/XRb4/uch0SxPx+ya78eTwAlc4UqdpWlxXrnmRKZoWsVOI8k4l++xp8dQFEqimHG98wX5jlVvaGv/WzMwhiXXNzSgwXWt1s1bTO4PBABm5vcGs3jznQ52f2Sf3h7z86aljVeFErzsDiNqiowzudBZlYbSB2z0naD+rRmYRVjc3Tq3XlKi5lIUtNX9CFMayWAVDkDwAX2X2yHP/0oLSVm0bDCzkFm96JA8e4EEZP2VnslaZi/Lx3LgVY/I+uUgFuPoMD/zgKcbmfpyYCcqjiYmreZZrSkTnvQ1L7OgGrw6ww2yZsls2GwMCIaCIltdM54iXypj2+BhdkNb7sSuKcFLGriKS1YQE4HASVoqERCQnuybtvX6xgC7ORmsaEqapbNTr1OPTBMigaZ7eVlg8pCkShZG X-Bogosity: Ham, tests=bogofilter, spamicity=0.000006, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
Introduce memcg_stock_pcp remote draining
|
expand
|
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 5b7f7c2e0232f..60712f69595e4 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -2183,9 +2183,6 @@ struct memcg_stock_pcp { int nr_slab_reclaimable_b; int nr_slab_unreclaimable_b; #endif - - unsigned long flags; -#define FLUSHING_CACHED_CHARGE 0 }; static DEFINE_PER_CPU_SHARED_ALIGNED(struct memcg_stock_pcp, memcg_stock) = { @@ -2281,7 +2278,6 @@ static void drain_stock_from(struct memcg_stock_pcp *stock) old = drain_obj_stock(stock); drain_stock(stock); - clear_bit(FLUSHING_CACHED_CHARGE, &stock->flags); spin_unlock_irqrestore(&stock->stock_lock, flags); if (old) @@ -2351,8 +2347,7 @@ static void drain_all_stock(struct mem_cgroup *root_memcg) flush = true; rcu_read_unlock(); - if (flush && - !test_and_set_bit(FLUSHING_CACHED_CHARGE, &stock->flags)) + if (flush) drain_stock_from(stock); } migrate_enable();
The flags member of struct memcg_stock_pcp has only one used bit: FLUSHING_CACHED_CHARGE Both struct member and flag were created to avoid scheduling multiple instances of kworkers running drain_local_stock() for a single cpu. How could this scenario happen before: - drain_all_stock() gets called, get ownership of percpu_charge_mutex, schedules a drain_local_stock() on cpu X, and drops ownership of percpu_charge_mutex. - Another thread calls drain_all_stock(), get ownership of percpu_charge_mutex, schedules a drain_local_stock() on cpu X, ... Since the stock draining is now performed by the thread running drain_all_stock(), and happens before letting go of the percpu_charge_mutex, there is no chance of another drain happening between test_and_set_bit() and clear_bit(), so flags is now useless. Remove the flags member of memcg_stock_pcp, its usages and the FLUSHING_CACHED_CHARGE define. Signed-off-by: Leonardo Bras <leobras@redhat.com> --- mm/memcontrol.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)