Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp11758pxk; Wed, 23 Sep 2020 20:30:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqmfElWjbDGLBK2cjcFAfzngbKX7YrchwAgPMaADYRSTaTDz5MTFgzEmvZWT0UrPeyTXBa X-Received: by 2002:a17:906:6a82:: with SMTP id p2mr2583630ejr.3.1600918224737; Wed, 23 Sep 2020 20:30:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600918224; cv=none; d=google.com; s=arc-20160816; b=V0utgwuKI8Nn0jx8Ap0yeGs+mqsUOS57Sf9cVf3jE6zlbstVdSCSYEeG8pQkHzPYHb VDETYxtSyWzsg8duGKtasNu9CY+oRN5rtleB6VuHgd0GywMxknL3YdKbPN1KeNr1eeun Dky6ygpxqkCO0FNYYnw62u5pnhPKmiuOyOG0ymErgpH/fXPS/zQ+lau02Gplnu4f7kVM 4Z1bWgXg81VO5oCtiC82ZSFe+XSxnFsPa3XGHq0EMkdHmWZNmK9kWjb1cKC0rmDFokkw HiDR0ZL6LxEiJQh8lo6qV+YBBxs4jU7z9lVVGpEckSHb+U5lSh0vQ2gOhjmtvtkikFBn TuNQ== 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=KabHK+cw+BhEZz1bhfnfS46WMxDhmUI4W8NSo0rBYyk=; b=KUJODbD9EZBB2vieY5O2OWbkamCgpL8e/omfvSWkxzWNMoGmKTg/q3hm+qyJjkjm3w naqjRXmAcTZGWiW0JAeBMU7fTxES+xp0yT2qiRzVJXrAaixGnv3pOoUj/KDBaDb0VXrA OoOY6eZ5IzlxgVTq741KlET23RSYE0E0P/ckGWnHD69Z70C0SLrfGiWWXFI02TidWdVq d1U0stwsgQzMlHmZNeBFBo2JyBRPcqc4sch+XQ9KIRg/sU4Zm4SORdFJ7/pboQoLC830 AuFai+CLLyRHNCnqjVAytoe9ITTqfDzrZ0c7lFjLN9kTtuMbmiy+f+7Bv7zB8c8ywEqY CWhQ== 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 u17si1273660edx.501.2020.09.23.20.30.01; Wed, 23 Sep 2020 20:30:24 -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 S1727159AbgIXD2x (ORCPT + 99 others); Wed, 23 Sep 2020 23:28:53 -0400 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:45646 "EHLO out30-44.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726874AbgIXD2p (ORCPT ); Wed, 23 Sep 2020 23:28:45 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04394;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=23;SR=0;TI=SMTPD_---0U9w0Ss1_1600918116; Received: from aliy80.localdomain(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0U9w0Ss1_1600918116) by smtp.aliyun-inc.com(127.0.0.1); Thu, 24 Sep 2020 11:28:41 +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, aaron.lwe@gmail.com Cc: Michal Hocko Subject: [PATCH v19 09/20] mm/memcg: add debug checking in lock_page_memcg Date: Thu, 24 Sep 2020 11:28:24 +0800 Message-Id: <1600918115-22007-10-git-send-email-alex.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1600918115-22007-1-git-send-email-alex.shi@linux.alibaba.com> References: <1600918115-22007-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 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 368e6ac644f0..6acc6a60c52b 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -2097,6 +2097,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