Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8547278ybl; Wed, 25 Dec 2019 01:06:42 -0800 (PST) X-Google-Smtp-Source: APXvYqxY+fdh3Vin0JbAVEONNqsWOOVoeScaeaKKk6g5DmKbsyeAihOsN7idK8mfyMcFGYMe2vqj X-Received: by 2002:a9d:4e92:: with SMTP id v18mr28523417otk.47.1577264802780; Wed, 25 Dec 2019 01:06:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577264802; cv=none; d=google.com; s=arc-20160816; b=glws6UrrsxDhlZxOEWVM00u5rzCoeKy+vmeDJfBIqCihFNb79KGfmAfThUrY1LHD6y B1/tUCIU+478tZbb1mqCeEK2yn2TFInWo+BAkgqtMllKMBwSVsx2PRSL3oE6BnELFL2p F8MKpSvEEW1jvL1OyWsrOY7oCEWMDhC2eLqtENgmGu8qV1PtonMeJM9z2MP9BuSebI1m nsYAbU3pkthflvuY9vnI9FtWgTR6jtP7kiCltUGuWnxB7CZpHQo+IISyjnUoVfB+aN+j 0aiTANf8Iqx9sFFeV/a5iz68MwaYUeL7fEPDog5at8qde/+pRFvnGZRblQJO2CX00vPb mciw== 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=gl5nJtMTCiFjzRgk3mkMlnAFVvqz/lFaS/lWPmJl+UY=; b=ziUMjbMfEIL0gEJ6iR5tBKVhj/fmn0iC9YsDHrvcDpyCXvzUBwocg3ELtBX+qBtryg 6oouZWOQ92f4fngoGkCssMWoCytdJ22d8ySAIkotth+zrKB1XS59Ol1W/9U9nwoVpM/D N1Jko2II17xGtvEfQ4x3gMDOQjuIh2CmDd0KLVycjLMg/hDMdGyEJukqgvmKhNeXGeRX 6XJoBdRP31tnCTnvjnhz6OYRFGfhFdu4sFmk/K5fO1LPyt0dNWaxplYQRog8rD4knUBA MW7OT38cHqgCAtu79vRUHzLEX3/M38QUxd1Rd71vHkmaKKo2+rgqnkecKEQbWKr7LCIU BbUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id j71si12711029oib.213.2019.12.25.01.06.30; Wed, 25 Dec 2019 01:06:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727121AbfLYJFT (ORCPT + 99 others); Wed, 25 Dec 2019 04:05:19 -0500 Received: from out30-54.freemail.mail.aliyun.com ([115.124.30.54]:43667 "EHLO out30-54.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726025AbfLYJEt (ORCPT ); Wed, 25 Dec 2019 04:04:49 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R631e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04420;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0TltG7dO_1577264684; Received: from localhost(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0TltG7dO_1577264684) by smtp.aliyun-inc.com(127.0.0.1); Wed, 25 Dec 2019 17:04:45 +0800 From: Alex Shi To: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, 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, shakeelb@google.com, hannes@cmpxchg.org Cc: Michal Hocko , Vladimir Davydov Subject: [PATCH v7 09/10] mm/lru: add debug checking for page memcg moving Date: Wed, 25 Dec 2019 17:04:25 +0800 Message-Id: <1577264666-246071-10-git-send-email-alex.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1577264666-246071-1-git-send-email-alex.shi@linux.alibaba.com> References: <1577264666-246071-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 This debug patch could give some clues if there are sth out of consideration. 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/compaction.c | 4 ++++ mm/memcontrol.c | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/mm/compaction.c b/mm/compaction.c index 8c0a2da217d8..f47820355b66 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -971,6 +971,10 @@ static bool too_many_isolated(pg_data_t *pgdat) compact_lock_irqsave(&lruvec->lru_lock, &flags, cc); locked_lruvec = lruvec; +#ifdef CONFIG_MEMCG + if (!mem_cgroup_disabled()) + VM_BUG_ON_PAGE(lruvec_memcg(lruvec) != page->mem_cgroup, page); +#endif /* Try get exclusive access under lock */ if (!skip_updated) { skip_updated = true; diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 1b69e27d1b9f..33bf086faed0 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1247,6 +1247,10 @@ struct lruvec *lock_page_lruvec_irq(struct page *page) lruvec = mem_cgroup_lruvec(memcg, page_pgdat(page)); spin_lock_irq(&lruvec->lru_lock); +#ifdef CONFIG_MEMCG + if (!mem_cgroup_disabled()) + VM_BUG_ON_PAGE(lruvec_memcg(lruvec) != page->mem_cgroup, page); +#endif return lruvec; } @@ -1259,6 +1263,10 @@ struct lruvec *lock_page_lruvec_irqsave(struct page *page, unsigned long *flags) lruvec = mem_cgroup_lruvec(memcg, page_pgdat(page)); spin_lock_irqsave(&lruvec->lru_lock, *flags); +#ifdef CONFIG_MEMCG + if (!mem_cgroup_disabled()) + VM_BUG_ON_PAGE(lruvec_memcg(lruvec) != page->mem_cgroup, page); +#endif return lruvec; } -- 1.8.3.1