Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1065831ybg; Wed, 10 Jun 2020 23:21:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYgvu5I1qwq34PQSua/rceXOxgURrXGN9+3sAgZdp/LphDT43ftq4XZPA+mrMMoDBoeSB/ X-Received: by 2002:a17:906:5418:: with SMTP id q24mr6826606ejo.266.1591856484888; Wed, 10 Jun 2020 23:21:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591856484; cv=none; d=google.com; s=arc-20160816; b=HxiCT4kCmBYOhreP73Ulvt2BhQolbuB8UceegG6aYBPViMNSFkKaWWSq7J6dEwAn74 1BGe0liU1c3S88edk/ULcWOgyM6VaUObO7EjVqw24F/zleDEcGMJI0yqeldZQGYpQ86f QyAxWUP56gAqd35iODWUbJ0jtd902yO+R7A7zdjvnvwDf+HmTiAJ54s4UZoIZdCNK4FP TCw3Mn7KZktHblFB+JJ6SLUh30ayEvDX65qjUXj4gbQkstJh4zWp2OAJS6NKKi9o7i4A zNCmFHCpiHrUcmri4B+ZE2Jvluv1387rWURJ8687F7mPPFCoKMacKPdu70hF2hhxEFDT cvvA== 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=rsT+WblLhm3xpX/g3ZEUbD3ScRD2cJwJv7LJRoTXOMI=; b=pde0wCj8Ht0SsVj0sKxDm6wtuzeVLX7ST8eDUYg44gyLjV/ZGlXmldhbPs95lX1wCN VZUDChn20KUHeZy2dg7HEiY+4vBDH8/RJDLeVKQZ7UKEnTtFk7HcCFSyWRkIh0bkiCIL Q86tW+B6CcwPLzSwk8svS9LaPFSkksUPqD6sFlwGarcOECGSZcmaW79M9U7m9f6mof6i +tjx6WmyNximVOnWWoxLmnnnLtVJEHxTl3JwoFswNmFH5Dg2JpxtCX7T+zX/ApVHEbVx kvPn2FAVDU5Zx9Vgbr69BNLuykK4jsQU63LrQ7vSl2q0gsAGtpzakaGcNgRbHAKFw4ew 0+0g== 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 p22si1019240edy.126.2020.06.10.23.21.01; Wed, 10 Jun 2020 23:21: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 S1726837AbgFKGRz (ORCPT + 99 others); Thu, 11 Jun 2020 02:17:55 -0400 Received: from out30-57.freemail.mail.aliyun.com ([115.124.30.57]:33299 "EHLO out30-57.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726671AbgFKGRQ (ORCPT ); Thu, 11 Jun 2020 02:17:16 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;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=18;SR=0;TI=SMTPD_---0U.EnDAM_1591856228; Received: from localhost(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0U.EnDAM_1591856228) by smtp.aliyun-inc.com(127.0.0.1); Thu, 11 Jun 2020 14:17:08 +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 Cc: Michal Hocko , Vladimir Davydov Subject: [PATCH v12 08/16] mm/memcg: add debug checking in lock_page_memcg Date: Thu, 11 Jun 2020 14:16:41 +0800 Message-Id: <1591856209-166869-9-git-send-email-alex.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1591856209-166869-1-git-send-email-alex.shi@linux.alibaba.com> References: <1591856209-166869-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 0b38b6ad547d..78c16ac1473d 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