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 X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63DFBC432BE for ; Tue, 27 Jul 2021 16:51:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 12F5F610CC for ; Tue, 27 Jul 2021 16:51:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 12F5F610CC Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 68D968D0002; Tue, 27 Jul 2021 12:51:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 648316B006C; Tue, 27 Jul 2021 12:51:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 52B7F8D0002; Tue, 27 Jul 2021 12:51:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0043.hostedemail.com [216.40.44.43]) by kanga.kvack.org (Postfix) with ESMTP id 35C766B005D for ; Tue, 27 Jul 2021 12:51:14 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D4947181DF769 for ; Tue, 27 Jul 2021 16:51:13 +0000 (UTC) X-FDA: 78408958026.10.8708CC2 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by imf01.hostedemail.com (Postfix) with ESMTP id 917E3504A321 for ; Tue, 27 Jul 2021 16:51:13 +0000 (UTC) Received: by mail-lf1-f45.google.com with SMTP id g13so22759907lfj.12 for ; Tue, 27 Jul 2021 09:51:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CluUB6u3e6vSvuTj9ZDWKd+9lXyRKKVlLnHCPzqySkA=; b=Y/LXubLHM6WaUYdSxC4yHzA/PTO+4Iqp9OsSGe3NsOGrtNlHl58r72AsYkXhdSCVQk D92+/e/bbScw3fEpORhyJziDUQ06Gip3vgD3hI415HLxOwopdy18WMhqzBtHqCVEgmxr SPY77804g9crzhfRDMDqNBaVg9Bl2zAu41NtTzjt29nfXSWgJUAXMlkN8MPczoEzISHv bbXgRZMI/bPixBkPOaTWs49nEb+UsiQSNOLJw9Q/S10QHZFu3H/OTvTsq+zZPxC0vjAh rrV7zb89dwiur8VffZobyLrz4fGDFLjJly+sTkMvJIcOfKoTB+1K2qPRuEuV0/d5a2z7 XRQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CluUB6u3e6vSvuTj9ZDWKd+9lXyRKKVlLnHCPzqySkA=; b=pU5ojZfTnMJo5rfTvr8aBlhXxoxhtz0ac6bU/o0mWmN/MFFFqnv0HgpcAUJABCght7 Kyees96isRWC0w3VTJp4JdVPsUc5qHdZhTm3V2+pyrD2l+qfP+KpoAW7Sx/joPUEQkH3 bzIBQJM6ns2G/QK15H7BBnd6jRuVS4zNt7CCsFMVWgpbiyjMe+TaKW68zhgAfuyLWg4p c60YztHOoCdILiaYlk0tMKoz62ur9c5YfROuvH1pwFUpyiieE8AZjcjfro4XtWtQq7Tl wsYElbl6bnCq9uocukLLQ5GMaDB8RU+LzwtIa64pMZJ2cH7GMnVvV5R6E/kAk/ixRxXb aJ+Q== X-Gm-Message-State: AOAM530cMHYes/SCDzVrHIS81U9E26lEfaTkBHemGJiv9kl2j4fTJPIW NlLNe+ll59lK4w335BQTFV4scfyVPPe9c1RO/c5Eiw== X-Google-Smtp-Source: ABdhPJwinnOp7LjvAilkuinLLIl+9qfP8oHa34sG0n2oo4sUeXbIfm5KNwPE3aKhFouKSl1emBjwQ+N+PxaU3gf/2s8= X-Received: by 2002:ac2:4d86:: with SMTP id g6mr17006316lfe.549.1627404671450; Tue, 27 Jul 2021 09:51:11 -0700 (PDT) MIME-Version: 1.0 References: <20210726150019.251820-1-hannes@cmpxchg.org> <2b0b08f9385b25fb7750dbe453516b0c8bb27604.camel@fb.com> In-Reply-To: <2b0b08f9385b25fb7750dbe453516b0c8bb27604.camel@fb.com> From: Shakeel Butt Date: Tue, 27 Jul 2021 09:51:00 -0700 Message-ID: Subject: Re: [PATCH] mm: memcontrol: fix blocking rstat function called from atomic cgroup1 thresholding code To: Rik van Riel Cc: "hannes@cmpxchg.org" , "akpm@linux-foundation.org" , Kernel Team , "dan.carpenter@oracle.com" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "cgroups@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 917E3504A321 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b="Y/LXubLH"; spf=pass (imf01.hostedemail.com: domain of shakeelb@google.com designates 209.85.167.45 as permitted sender) smtp.mailfrom=shakeelb@google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: 3iia5gukxapni35xn8iybbog39xra6hc X-HE-Tag: 1627404673-217099 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 Mon, Jul 26, 2021 at 8:19 AM Rik van Riel wrote: > > On Mon, 2021-07-26 at 11:00 -0400, Johannes Weiner wrote: > > > > __mem_cgroup_threshold() indeed holds the rcu lock. In addition, the > > thresholding code is invoked during stat changes, and those contexts > > have irqs disabled as well. If the lock breaking occurs inside the > > flush function, it will result in a sleep from an atomic context. > > > > Use the irsafe flushing variant in mem_cgroup_usage() to fix this > > While this fix is necessary, in the long term I think we may > want some sort of redesign here, to make sure the irq safe > version does not spin long times trying to get the statistics > off some other CPU. > > I have seen a number of soft (IIRC) lockups deep inside the > bowels of cgroup_rstat_flush_irqsafe, with the function taking > multiple seconds to complete. Can you please share a bit more detail on this lockup? I am wondering if this was due to the flush not happening more often and thus the update tree is large or if there are too many concurrent flushes happening. > > Reviewed-by: Rik van Riel