linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC] restore user defined min_free_kbytes when disabling thp
@ 2014-01-21  9:38 Han Pingtian
  2014-01-21 10:23 ` Mel Gorman
  0 siblings, 1 reply; 4+ messages in thread
From: Han Pingtian @ 2014-01-21  9:38 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, Michal Hocko, Mel Gorman, linux-mm, Dave Hansen,
	David Rientjes

The testcase 'thp04' of LTP will enable THP, do some testing, then
disable it if it wasn't enabled. But this will leave a different value
of min_free_kbytes if it has been set by admin. So I think it's better
to restore the user defined value after disabling THP.

---

thp increases the value of min_free_kbytes in initialization. This will
change the user defined value of min_free_kbytes. So try to restore the
value when disabling thp.

Signed-off-by: Han Pingtian <hanpt@linux.vnet.ibm.com>
---
 mm/huge_memory.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 94a824f..276180b 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -164,6 +164,15 @@ static int start_khugepaged(void)
 	} else if (khugepaged_thread) {
 		kthread_stop(khugepaged_thread);
 		khugepaged_thread = NULL;
+
+		if (user_min_free_kbytes >= 0) {
+			pr_info("restore min_free_kbytes from %d to user "
+				"defined %d when stopping khugepaged\n",
+				min_free_kbytes, user_min_free_kbytes);
+
+			min_free_kbytes = user_min_free_kbytes;
+			setup_per_zone_wmarks();
+		}
 	}
 
 	return err;
-- 
1.7.7.6

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] restore user defined min_free_kbytes when disabling thp
  2014-01-21  9:38 [RFC] restore user defined min_free_kbytes when disabling thp Han Pingtian
@ 2014-01-21 10:23 ` Mel Gorman
  2014-01-22  6:05   ` Han Pingtian
  0 siblings, 1 reply; 4+ messages in thread
From: Mel Gorman @ 2014-01-21 10:23 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, Michal Hocko, linux-mm, Dave Hansen,
	David Rientjes

On Tue, Jan 21, 2014 at 05:38:59PM +0800, Han Pingtian wrote:
> The testcase 'thp04' of LTP will enable THP, do some testing, then
> disable it if it wasn't enabled. But this will leave a different value
> of min_free_kbytes if it has been set by admin. So I think it's better
> to restore the user defined value after disabling THP.
> 

Then have LTP record what min_free_kbytes was at the same time THP was
enabled by the test and restore both settings. It leaves a window where
an admin can set an alternative value during the test but that would also
invalidate the test in same cases and gets filed under "don't do that".

-- 
Mel Gorman
SUSE Labs

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] restore user defined min_free_kbytes when disabling thp
  2014-01-21 10:23 ` Mel Gorman
@ 2014-01-22  6:05   ` Han Pingtian
  2014-01-22  9:40     ` Mel Gorman
  0 siblings, 1 reply; 4+ messages in thread
From: Han Pingtian @ 2014-01-22  6:05 UTC (permalink / raw)
  To: Mel Gorman
  Cc: linux-kernel, Andrew Morton, Michal Hocko, linux-mm, Dave Hansen,
	David Rientjes

On Tue, Jan 21, 2014 at 10:23:51AM +0000, Mel Gorman wrote:
> On Tue, Jan 21, 2014 at 05:38:59PM +0800, Han Pingtian wrote:
> > The testcase 'thp04' of LTP will enable THP, do some testing, then
> > disable it if it wasn't enabled. But this will leave a different value
> > of min_free_kbytes if it has been set by admin. So I think it's better
> > to restore the user defined value after disabling THP.
> > 
> 
> Then have LTP record what min_free_kbytes was at the same time THP was
> enabled by the test and restore both settings. It leaves a window where
> an admin can set an alternative value during the test but that would also
> invalidate the test in same cases and gets filed under "don't do that".
> 

Because the value is changed in kernel, so it would be better to 
restore it in kernel, right? :)  I have a v2 patch which will restore
the value only if it isn't set again by user after THP's initialization.
This v2 patch is dependent on the patch 'mm: show message when updating
min_free_kbytes in thp' which has been added to -mm tree, can be found
here:

http://ozlabs.org/~akpm/mmotm/broken-out/mm-show-message-when-updating-min_free_kbytes-in-thp.patch

please have a look. Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] restore user defined min_free_kbytes when disabling thp
  2014-01-22  6:05   ` Han Pingtian
@ 2014-01-22  9:40     ` Mel Gorman
  0 siblings, 0 replies; 4+ messages in thread
From: Mel Gorman @ 2014-01-22  9:40 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, Michal Hocko, linux-mm, Dave Hansen,
	David Rientjes

On Wed, Jan 22, 2014 at 02:05:06PM +0800, Han Pingtian wrote:
> On Tue, Jan 21, 2014 at 10:23:51AM +0000, Mel Gorman wrote:
> > On Tue, Jan 21, 2014 at 05:38:59PM +0800, Han Pingtian wrote:
> > > The testcase 'thp04' of LTP will enable THP, do some testing, then
> > > disable it if it wasn't enabled. But this will leave a different value
> > > of min_free_kbytes if it has been set by admin. So I think it's better
> > > to restore the user defined value after disabling THP.
> > > 
> > 
> > Then have LTP record what min_free_kbytes was at the same time THP was
> > enabled by the test and restore both settings. It leaves a window where
> > an admin can set an alternative value during the test but that would also
> > invalidate the test in same cases and gets filed under "don't do that".
> > 
> 
> Because the value is changed in kernel, so it would be better to 
> restore it in kernel, right? :)  I have a v2 patch which will restore
> the value only if it isn't set again by user after THP's initialization.
> This v2 patch is dependent on the patch 'mm: show message when updating
> min_free_kbytes in thp' which has been added to -mm tree, can be found
> here:
> 

It still feels like the type of scenario that only shows up during tests
that modify kernel parameters as part of the test. I do not consider it
normal operation for THP to be enabled and disabled multiple types during
the lifetime of the system. If the system started with THP disabled, ran
for a long period of time then the benefit of having min_free_kbytes at
a higher value is already lost due to the system being potentially in a
fragmented state already.

I'm ok with the warning being displayed if min_free_kbytes is updated
but I'm not convinced that further trickery is necessary.

-- 
Mel Gorman
SUSE Labs

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-22  9:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-21  9:38 [RFC] restore user defined min_free_kbytes when disabling thp Han Pingtian
2014-01-21 10:23 ` Mel Gorman
2014-01-22  6:05   ` Han Pingtian
2014-01-22  9:40     ` Mel Gorman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox