From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk0-f178.google.com (mail-qk0-f178.google.com [209.85.220.178]) by kanga.kvack.org (Postfix) with ESMTP id 4CA60280291 for ; Sun, 5 Jul 2015 04:23:17 -0400 (EDT) Received: by qkeo142 with SMTP id o142so99320940qke.1 for ; Sun, 05 Jul 2015 01:23:17 -0700 (PDT) Received: from nm47-vm8.bullet.mail.bf1.yahoo.com (nm47-vm8.bullet.mail.bf1.yahoo.com. [216.109.115.143]) by mx.google.com with ESMTPS id j88si16750113qkh.113.2015.07.05.01.23.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 05 Jul 2015 01:23:16 -0700 (PDT) Date: Sun, 5 Jul 2015 08:20:16 +0000 (UTC) From: PINTU KUMAR Reply-To: PINTU KUMAR Message-ID: <122973238.2709954.1436084416779.JavaMail.yahoo@mail.yahoo.com> In-Reply-To: <169308.1436040527@turing-police.cc.vt.edu> References: <169308.1436040527@turing-police.cc.vt.edu> Subject: Re: [PATCH 1/1] kernel/sysctl.c: Add /proc/sys/vm/shrink_memory feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: "Valdis.Kletnieks@vt.edu" , Pintu Kumar Cc: "corbet@lwn.net" , "akpm@linux-foundation.org" , "vbabka@suse.cz" , "gorcunov@openvz.org" , "mhocko@suse.cz" , "emunson@akamai.com" , "kirill.shutemov@linux.intel.com" , "standby24x7@gmail.com" , "hannes@cmpxchg.org" , "vdavydov@parallels.com" , "hughd@google.com" , "minchan@kernel.org" , "tj@kernel.org" , "rientjes@google.com" , "xypron.glpk@gmx.de" , "dzickus@redhat.com" , "prarit@redhat.com" , "ebiederm@xmission.com" , "rostedt@goodmis.org" , "uobergfe@redhat.com" , "paulmck@linux.vnet.ibm.com" , "iamjoonsoo.kim@lge.com" , "ddstreet@ieee.org" , "sasha.levin@oracle.com" , "koct9i@gmail.com" , "mgorman@suse.de" , "cj@linux.com" , "opensource.ganesh@gmail.com" , "vinmenon@codeaurora.org" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "linux-pm@vger.kernel.org" , "cpgs@samsung.com" , "vishnu.ps@samsung.com" , "rohit.kr@samsung.com" , "iqbal.ams@samsung.com" ----- Original Message ----- > From: "Valdis.Kletnieks@vt.edu" > To: Pintu Kumar > Cc: corbet@lwn.net; akpm@linux-foundation.org; vbabka@suse.cz; gorcunov@openvz.org; mhocko@suse.cz; emunson@akamai.com; kirill.shutemov@linux.intel.com; standby24x7@gmail.com; hannes@cmpxchg.org; vdavydov@parallels.com; hughd@google.com; minchan@kernel.org; tj@kernel.org; rientjes@google.com; xypron.glpk@gmx.de; dzickus@redhat.com; prarit@redhat.com; ebiederm@xmission.com; rostedt@goodmis.org; uobergfe@redhat.com; paulmck@linux.vnet.ibm.com; iamjoonsoo.kim@lge.com; ddstreet@ieee.org; sasha.levin@oracle.com; koct9i@gmail.com; mgorman@suse.de; cj@linux.com; opensource.ganesh@gmail.com; vinmenon@codeaurora.org; linux-doc@vger.kernel.org; linux-kernel@vger.kernel.org; linux-mm@kvack.org; linux-pm@vger.kernel.org; cpgs@samsung.com; pintu_agarwal@yahoo.com; vishnu.ps@samsung.com; rohit.kr@samsung.com; iqbal.ams@samsung.com > Sent: Sunday, 5 July 2015 1:38 AM > Subject: Re: [PATCH 1/1] kernel/sysctl.c: Add /proc/sys/vm/shrink_memory feature > > On Fri, 03 Jul 2015 18:50:07 +0530, Pintu Kumar said: > >> This patch provides 2 things: > >> 2. Enable shrink_all_memory API in kernel with new CONFIG_SHRINK_MEMORY. >> Currently, shrink_all_memory function is used only during hibernation. >> With the new config we can make use of this API for non-hibernation case >> also without disturbing the hibernation case. > >> --- a/mm/vmscan.c >> +++ b/mm/vmscan.c > >> @@ -3571,12 +3571,17 @@ unsigned long shrink_all_memory(unsigned long > nr_to_reclaim) >> struct reclaim_state reclaim_state; >> struct scan_control sc = { >> .nr_to_reclaim = nr_to_reclaim, >> +#ifdef CONFIG_SHRINK_MEMORY >> + .gfp_mask = (GFP_HIGHUSER_MOVABLE | GFP_RECLAIM_MASK), >> + .hibernation_mode = 0, >> +#else >> .gfp_mask = GFP_HIGHUSER_MOVABLE, >> + .hibernation_mode = 1, >> +#endif > > > That looks like a bug just waiting to happen. What happens if we > call an actual hibernation mode in a SHRINK_MEMORY=y kernel, and it finds > an extra gfp mask bit set, and hibernation_mode set to an unexpected value? > Ok, got it. Thanks for pointing this out. I will handle HIBERNATION & SHRINK_MEMORY case and send again. Do you have any special suggestions on how this can be handled? -- 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