From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergey Senozhatsky Subject: Re: [PATCH] mm/workingset: do not forget to unlock page Date: Wed, 3 Feb 2016 19:41:36 +0900 Message-ID: <20160203104136.GA517@swordfish> References: <1454493513-19316-1-git-send-email-sergey.senozhatsky@gmail.com> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=LArXUZJdbe/qme3suyjet8uQSVmzf9pmoQhUfdzKyOs=; b=Qxk2lZJfsQJObWVv3eKQvfvRu52+pQJF5sS+TxReqcMiO//bHt+BWdzb9D2mVXMpN/ iQwWd/HRzemgfOmETlyil2VhjgjQZtbxaRZdU8c30NPrp2TsIueMD277Qzogk+ppHQ7Q UwomlR0CwwaDgKbcQPVSouz2gLOytoLD+zrkPHx5pWV6RnICT9KvDPqTFA06aFfyXcgf VwqNduo28e9Y9GPo2r5DB5FisalBE4opZAt6v66th5GuVKENKS2eOMRT2HMzhbPYRAN7 qrFVdQGcCPsjFrHoR2XJIaXMp73NBZsKqSPtwZEAnDkW26+N1G/zRGLAfM1C4SINfzdg ePzQ== Content-Disposition: inline In-Reply-To: <1454493513-19316-1-git-send-email-sergey.senozhatsky@gmail.com> Sender: owner-linux-mm@kvack.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Andrew Morton Cc: Johannes Weiner , Vladimir Davydov , Michal Hocko , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky , Sergey Senozhatsky On (02/03/16 18:58), Sergey Senozhatsky wrote: > > Do not leave page locked (and RCU read side locked) when > return from workingset_activation() due to disabled memcg > or page not being a page_memcg(). d'oh... sorry, the commit message is simply insane. apparently the patch fixes a new code mm-workingset-per-cgroup-cache-thrash-detection.patch added to -mm tree mm-simplify-lock_page_memcg.patch added to -mm tree so if there is an option to fold this patch into mm-simplify-lock_page_memcg, for example, as a -fix, then I wouldn't mind at all. a better commit message ===8<====8<==== >From 1d6315221f2f81c53c99f9980158f8ae49dbd582 Mon Sep 17 00:00:00 2001 From: Sergey Senozhatsky Date: Wed, 3 Feb 2016 18:49:16 +0900 Subject: [PATCH] mm/workingset: do not forget to unlock_page in workingset_activation Do not return from workingset_activation() with locked rcu and page. Signed-off-by: Sergey Senozhatsky --- mm/workingset.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/workingset.c b/mm/workingset.c index 14522ed..54138a9 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -315,8 +315,10 @@ void workingset_activation(struct page *page) * XXX: See workingset_refault() - this should return * root_mem_cgroup even for !CONFIG_MEMCG. */ - if (!mem_cgroup_disabled() && !page_memcg(page)) + if (!mem_cgroup_disabled() && !page_memcg(page)) { + unlock_page_memcg(page); return; + } lruvec = mem_cgroup_zone_lruvec(page_zone(page), page_memcg(page)); atomic_long_inc(&lruvec->inactive_age); unlock_page_memcg(page); -- 2.7.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f179.google.com (mail-pf0-f179.google.com [209.85.192.179]) by kanga.kvack.org (Postfix) with ESMTP id 3D9146B0253 for ; Wed, 3 Feb 2016 05:40:25 -0500 (EST) Received: by mail-pf0-f179.google.com with SMTP id 65so11925909pfd.2 for ; Wed, 03 Feb 2016 02:40:25 -0800 (PST) Received: from mail-pf0-x234.google.com (mail-pf0-x234.google.com. [2607:f8b0:400e:c00::234]) by mx.google.com with ESMTPS id bw10si8600392pab.22.2016.02.03.02.40.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Feb 2016 02:40:24 -0800 (PST) Received: by mail-pf0-x234.google.com with SMTP id w123so11995744pfb.0 for ; Wed, 03 Feb 2016 02:40:24 -0800 (PST) Date: Wed, 3 Feb 2016 19:41:36 +0900 From: Sergey Senozhatsky Subject: Re: [PATCH] mm/workingset: do not forget to unlock page Message-ID: <20160203104136.GA517@swordfish> References: <1454493513-19316-1-git-send-email-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1454493513-19316-1-git-send-email-sergey.senozhatsky@gmail.com> Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton Cc: Johannes Weiner , Vladimir Davydov , Michal Hocko , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky , Sergey Senozhatsky On (02/03/16 18:58), Sergey Senozhatsky wrote: > > Do not leave page locked (and RCU read side locked) when > return from workingset_activation() due to disabled memcg > or page not being a page_memcg(). d'oh... sorry, the commit message is simply insane. apparently the patch fixes a new code mm-workingset-per-cgroup-cache-thrash-detection.patch added to -mm tree mm-simplify-lock_page_memcg.patch added to -mm tree so if there is an option to fold this patch into mm-simplify-lock_page_memcg, for example, as a -fix, then I wouldn't mind at all. a better commit message ===8<====8<==== From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752537AbcBCKka (ORCPT ); Wed, 3 Feb 2016 05:40:30 -0500 Received: from mail-pf0-f174.google.com ([209.85.192.174]:36735 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750741AbcBCKkZ (ORCPT ); Wed, 3 Feb 2016 05:40:25 -0500 Date: Wed, 3 Feb 2016 19:41:36 +0900 From: Sergey Senozhatsky To: Andrew Morton Cc: Johannes Weiner , Vladimir Davydov , Michal Hocko , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky , Sergey Senozhatsky Subject: Re: [PATCH] mm/workingset: do not forget to unlock page Message-ID: <20160203104136.GA517@swordfish> References: <1454493513-19316-1-git-send-email-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1454493513-19316-1-git-send-email-sergey.senozhatsky@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (02/03/16 18:58), Sergey Senozhatsky wrote: > > Do not leave page locked (and RCU read side locked) when > return from workingset_activation() due to disabled memcg > or page not being a page_memcg(). d'oh... sorry, the commit message is simply insane. apparently the patch fixes a new code mm-workingset-per-cgroup-cache-thrash-detection.patch added to -mm tree mm-simplify-lock_page_memcg.patch added to -mm tree so if there is an option to fold this patch into mm-simplify-lock_page_memcg, for example, as a -fix, then I wouldn't mind at all. a better commit message ===8<====8<==== >>From 1d6315221f2f81c53c99f9980158f8ae49dbd582 Mon Sep 17 00:00:00 2001 From: Sergey Senozhatsky Date: Wed, 3 Feb 2016 18:49:16 +0900 Subject: [PATCH] mm/workingset: do not forget to unlock_page in workingset_activation Do not return from workingset_activation() with locked rcu and page. Signed-off-by: Sergey Senozhatsky --- mm/workingset.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/workingset.c b/mm/workingset.c index 14522ed..54138a9 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -315,8 +315,10 @@ void workingset_activation(struct page *page) * XXX: See workingset_refault() - this should return * root_mem_cgroup even for !CONFIG_MEMCG. */ - if (!mem_cgroup_disabled() && !page_memcg(page)) + if (!mem_cgroup_disabled() && !page_memcg(page)) { + unlock_page_memcg(page); return; + } lruvec = mem_cgroup_zone_lruvec(page_zone(page), page_memcg(page)); atomic_long_inc(&lruvec->inactive_age); unlock_page_memcg(page); -- 2.7.0