Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp335151pxb; Thu, 5 Nov 2020 01:00:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJwtt9ygH88qXyy0o1infD6+zBK2IawHiEc6NeWSBCCID8hkJxXBp6TQ06t1BuLVpnWa+03j X-Received: by 2002:aa7:ce82:: with SMTP id y2mr1558690edv.6.1604566846874; Thu, 05 Nov 2020 01:00:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604566846; cv=none; d=google.com; s=arc-20160816; b=x+XV6bueROUIWr6UNjhqQ48Ez5NDsS0GDRfTuvyxYVcCxkqDGZtG/N7o+OhwL/Sbwp /MHIZSV+1QMUJzn4XLRyeSnoMJT4Ro+KkvLgZsqHIRCWPIJoymG2JBYB51miUF9tnQ0j cTKawQ5DJztsBYhcxyuW8Dzb19cn7vm42ydtu3z3pXygBbPl2vjPBnNSKD/LTYRKNDxg sqnrm8g+R5mm+Nc+qyOwqCxQBBLZhK/MU7LUb6Xr/IMXeeVnPYAzll9FqHqLnAmalet3 DatSadB0tvnsTeHy6ufkef7CRdBzjScwWKjbnE4Scoh35+sr6jiRmCojdRd1dERDBcJy V3wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=bbrCCzpnjVLOJrnR7n0ZjdoCDSKfzthY94nElgcQqI4=; b=0gTSrmSgKO2B72wyWMeykgba5jekGb5juNFKcuvOOyhx9q7Q441kMdIhp4PaeecvM1 GWqRCNQvgbZyIANJRzP/hKdnsaJvW5O8YbCnPwkoNOywm227fKRSPi4p5eCU/NZqEdAD qZ8qB1O/g5YYn1+JqrNTcTekGZxz531lXPZfsBWzx2WM9737nxIDWFEe+9Y1LEl8YjaK tT+MjdgRh32a33H8mnAMCz89IlPxrYQeMJT4KdNe4w1baVEAHocSg2MCmPF1iiYedwKU rOkM1VN6P6SCTQmN5aalwrYjJT8U1IqfhBdSukbs+QF63C3tUQbK2d+/zWkncZh848T6 H7rw== 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 w22si666750edl.537.2020.11.05.01.00.23; Thu, 05 Nov 2020 01:00:46 -0800 (PST) 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 S1731106AbgKEI4d (ORCPT + 99 others); Thu, 5 Nov 2020 03:56:33 -0500 Received: from out30-43.freemail.mail.aliyun.com ([115.124.30.43]:59217 "EHLO out30-43.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730475AbgKEI4S (ORCPT ); Thu, 5 Nov 2020 03:56:18 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R661e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=22;SR=0;TI=SMTPD_---0UEJC3Fv_1604566567; Received: from aliy80.localdomain(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0UEJC3Fv_1604566567) by smtp.aliyun-inc.com(127.0.0.1); Thu, 05 Nov 2020 16:56:11 +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, 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, mhocko@suse.com, vdavydov.dev@gmail.com, shy828301@gmail.com Cc: Michal Hocko Subject: [PATCH v21 08/19] mm/memcg: add debug checking in lock_page_memcg Date: Thu, 5 Nov 2020 16:55:38 +0800 Message-Id: <1604566549-62481-9-git-send-email-alex.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604566549-62481-1-git-send-email-alex.shi@linux.alibaba.com> References: <1604566549-62481-1-git-send-email-alex.shi@linux.alibaba.com> 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 Acked-by: Hugh Dickins Acked-by: Johannes Weiner 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 b2aa3b73ab82..157b745031a4 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -2121,6 +2121,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