----- Original Message ----- > From: "Valdis.Kletnieks@xxxxxx" <Valdis.Kletnieks@xxxxxx> > To: Pintu Kumar <pintu.k@xxxxxxxxxxx> > Cc: corbet@xxxxxxx; akpm@xxxxxxxxxxxxxxxxxxxx; vbabka@xxxxxxx; gorcunov@xxxxxxxxxx; mhocko@xxxxxxx; emunson@xxxxxxxxxx; kirill.shutemov@xxxxxxxxxxxxxxx; standby24x7@xxxxxxxxx; hannes@xxxxxxxxxxx; vdavydov@xxxxxxxxxxxxx; hughd@xxxxxxxxxx; minchan@xxxxxxxxxx; tj@xxxxxxxxxx; rientjes@xxxxxxxxxx; xypron.glpk@xxxxxx; dzickus@xxxxxxxxxx; prarit@xxxxxxxxxx; ebiederm@xxxxxxxxxxxx; rostedt@xxxxxxxxxxx; uobergfe@xxxxxxxxxx; paulmck@xxxxxxxxxxxxxxxxxx; iamjoonsoo.kim@xxxxxxx; ddstreet@xxxxxxxx; sasha.levin@xxxxxxxxxx; koct9i@xxxxxxxxx; mgorman@xxxxxxx; cj@xxxxxxxxx; opensource.ganesh@xxxxxxxxx; vinmenon@xxxxxxxxxxxxxx; linux-doc@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-mm@xxxxxxxxx; linux-pm@xxxxxxxxxxxxxxx; cpgs@xxxxxxxxxxx; pintu_agarwal@xxxxxxxxx; vishnu.ps@xxxxxxxxxxx; rohit.kr@xxxxxxxxxxx; iqbal.ams@xxxxxxxxxxx > 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. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>