Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2929198ybh; Sat, 25 Jul 2020 06:03:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnZbTx5+hzjlGRXRLilOBb29GHB5AdD5DoZ2siQYZ7+Udss7Tdg/Azkt0Dj/CEaST5dc7o X-Received: by 2002:a17:906:53c1:: with SMTP id p1mr7232260ejo.15.1595682197989; Sat, 25 Jul 2020 06:03:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595682197; cv=none; d=google.com; s=arc-20160816; b=MH+6KS1UjybnoYyYNibPc0BM6TS4sklSq/00KesIn7ccapsXgcZ2vR+rrKlWT5PE/U jMtKuWdL7Ld7Rtiz2KJglpwoJ5sFUWUfMlTO/6dKtF2HsZ7TKDvqWSpXzGzKXe9fPAO1 BVlQ7cmYrBh1dhPicy35FcKORLpB0wp+G3pz6Bok9STwx95s+Oym+nXKlnrdYwB1AUCf t37W8Sbj7Aznw8lGg19Y1UKvpWhYnEsJtS4lvJ5AcMq5y+A3MidBQFluPZOK9EQWKL4P vws6JnfatrUf5c7qCVkgXG5i+QzBFyEzMAMA0JgnpuwO5l2cLBU4ERiKcxZU09RdskkO W3Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=k4yOiqPtLNVwj9dgSChO9/I5nTShyz/AcFtbt+vNUZ4=; b=Vy2LHCRHtycCDN0E9IANlGdCot5Wkg1ozgLCbkqCnZWuEj12qh43fIsPXFahqXYfzN bALKqn301IklENRhqb5k38yhSCaNBLCpLjXLKWfmfamO/gcnj+LPBM8Umr8sLIa1xX5Z wsJeMzlhNvG778H3hEX1I40jfm+nVKpGeKoTEx1AipvEySmAP4G56gFvOAQitJsI9zKm G/JDtuRw8PiQmh5Ou284IYBYK9BxVpPRVkZemGhB1prSPMkHHlc9FnNAOtd1Nsmz1RXK 0CAgf7i5r9NzJYD3QKRqflYsWqNeze/l01HBz+emW1gy00nKf70lvTb7HVtijwEn7SCr Tp5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e6si2351343ejt.528.2020.07.25.06.02.55; Sat, 25 Jul 2020 06:03:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728027AbgGYNBq (ORCPT + 99 others); Sat, 25 Jul 2020 09:01:46 -0400 Received: from out30-43.freemail.mail.aliyun.com ([115.124.30.43]:47728 "EHLO out30-43.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727079AbgGYNA3 (ORCPT ); Sat, 25 Jul 2020 09:00:29 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R951e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04427;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=21;SR=0;TI=SMTPD_---0U3l6fmD_1595682015; Received: from aliy8.localdomain(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0U3l6fmD_1595682015) by smtp.aliyun-inc.com(127.0.0.1); Sat, 25 Jul 2020 21:00:24 +0800 From: Alex Shi To: akpm@linux-foundation.org, mgorman@techsingularity.net, tj@kernel.org, hughd@google.com, khlebnikov@yandex-team.ru, daniel.m.jordan@oracle.com, yang.shi@linux.alibaba.com, willy@infradead.org, hannes@cmpxchg.org, lkp@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, shakeelb@google.com, iamjoonsoo.kim@lge.com, richard.weiyang@gmail.com, kirill@shutemov.name, alexander.duyck@gmail.com, rong.a.chen@intel.com Cc: Michal Hocko , Vladimir Davydov Subject: [PATCH v17 09/21] mm/memcg: add debug checking in lock_page_memcg Date: Sat, 25 Jul 2020 20:59:46 +0800 Message-Id: <1595681998-19193-10-git-send-email-alex.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1595681998-19193-1-git-send-email-alex.shi@linux.alibaba.com> References: <1595681998-19193-1-git-send-email-alex.shi@linux.alibaba.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a debug checking in lock_page_memcg, then we could get alarm if anything wrong here. Suggested-by: Johannes Weiner Signed-off-by: Alex Shi Cc: Johannes Weiner Cc: Michal Hocko Cc: Vladimir Davydov Cc: Andrew Morton Cc: cgroups@vger.kernel.org Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/memcontrol.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 5d45a9159af9..20c8ed69a930 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1983,6 +1983,12 @@ struct mem_cgroup *lock_page_memcg(struct page *page) if (unlikely(!memcg)) return NULL; +#ifdef CONFIG_PROVE_LOCKING + local_irq_save(flags); + might_lock(&memcg->move_lock); + local_irq_restore(flags); +#endif + if (atomic_read(&memcg->moving_account) <= 0) return memcg; -- 1.8.3.1