Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-24 Thread Aaron Lu
On Tue, Mar 21, 2017 at 07:54:37AM -0700, Dave Hansen wrote: > On 03/16/2017 02:07 AM, Michal Hocko wrote: > > On Wed 15-03-17 14:38:34, Tim Chen wrote: > >> max_active: time > >> 1 8.9s ±0.5% > >> 2 5.65s ±5.5% > >> 4 4.84s ±0.16% > >> 8 4.77s

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-22 Thread Aaron Lu
On Tue, Mar 21, 2017 at 07:54:37AM -0700, Dave Hansen wrote: > On 03/16/2017 02:07 AM, Michal Hocko wrote: > > On Wed 15-03-17 14:38:34, Tim Chen wrote: > >> max_active: time > >> 1 8.9s ±0.5% > >> 2 5.65s ±5.5% > >> 4 4.84s ±0.16% > >> 8 4.77s

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-21 Thread Tim Chen
On Thu, 2017-03-16 at 10:07 +0100, Michal Hocko wrote: >  > > > the main problem is that kworkers will not belong to the same cpu group > > > and so they will not be throttled properly. > > You do have a point that this page freeing activities should strive to > > affect other threads not in the sa

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-21 Thread Dave Hansen
On 03/16/2017 02:07 AM, Michal Hocko wrote: > On Wed 15-03-17 14:38:34, Tim Chen wrote: >> max_active: time >> 1 8.9s ±0.5% >> 2 5.65s ±5.5% >> 4 4.84s ±0.16% >> 8 4.77s ±0.97% >> 164.85s ±0.77% >> 326.21s ±0.46% > >

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-20 Thread Alex Thorlton
On Fri, Mar 17, 2017 at 10:21:58AM +0800, Aaron Lu wrote: > On Thu, Mar 16, 2017 at 02:38:44PM -0500, Alex Thorlton wrote: > > On Wed, Mar 15, 2017 at 04:59:59PM +0800, Aaron Lu wrote: > > > v2 changes: Nothing major, only minor ones. > > > - rebased on top of v4.11-rc2-mmotm-2017-03-14-15-41; > >

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-17 Thread Michal Hocko
On Fri 17-03-17 13:53:33, Peter Zijlstra wrote: > On Fri, Mar 17, 2017 at 08:47:08AM +0100, Michal Hocko wrote: > > On Thu 16-03-17 11:36:21, Tim Chen wrote: > > [...] > > > Perhaps we can only do this expedited exit only when there are idle cpus > > > around. > > > We can use the root sched domai

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-17 Thread Peter Zijlstra
On Fri, Mar 17, 2017 at 08:33:15PM +0800, Aaron Lu wrote: > On Fri, Mar 17, 2017 at 08:47:08AM +0100, Michal Hocko wrote: > > On Thu 16-03-17 11:36:21, Tim Chen wrote: > > [...] > > > Perhaps we can only do this expedited exit only when there are idle cpus > > > around. > > > We can use the root s

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-17 Thread Michal Hocko
On Fri 17-03-17 20:33:15, Aaron Lu wrote: > On Fri, Mar 17, 2017 at 08:47:08AM +0100, Michal Hocko wrote: > > On Thu 16-03-17 11:36:21, Tim Chen wrote: > > [...] > > > Perhaps we can only do this expedited exit only when there are idle cpus > > > around. > > > We can use the root sched domain's ov

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-17 Thread Peter Zijlstra
On Fri, Mar 17, 2017 at 08:47:08AM +0100, Michal Hocko wrote: > On Thu 16-03-17 11:36:21, Tim Chen wrote: > [...] > > Perhaps we can only do this expedited exit only when there are idle cpus > > around. > > We can use the root sched domain's overload indicator for such a quick > > check. > > Thi

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-17 Thread Aaron Lu
On Fri, Mar 17, 2017 at 08:47:08AM +0100, Michal Hocko wrote: > On Thu 16-03-17 11:36:21, Tim Chen wrote: > [...] > > Perhaps we can only do this expedited exit only when there are idle cpus > > around. > > We can use the root sched domain's overload indicator for such a quick > > check. > > Thi

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-17 Thread Michal Hocko
On Thu 16-03-17 11:36:21, Tim Chen wrote: [...] > Perhaps we can only do this expedited exit only when there are idle cpus > around. > We can use the root sched domain's overload indicator for such a quick check. This is not so easy, I am afraid. Those CPUs might be idle for a good reason (power

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-17 Thread Minchan Kim
On Fri, Mar 17, 2017 at 08:47:08AM +0100, Michal Hocko wrote: > On Thu 16-03-17 11:36:21, Tim Chen wrote: > [...] > > Perhaps we can only do this expedited exit only when there are idle cpus > > around. > > We can use the root sched domain's overload indicator for such a quick > > check. > > Thi

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-16 Thread Aaron Lu
On Wed, Mar 15, 2017 at 03:56:02PM +0100, Vlastimil Babka wrote: > I wonder if the difference would be larger if the parallelism was done > on a higher level, something around unmap_page_range(). IIUC the current I guess I misunderstand you in my last email - doing it at unmap_page_range() level i

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-16 Thread Aaron Lu
On Thu, Mar 16, 2017 at 02:38:44PM -0500, Alex Thorlton wrote: > On Wed, Mar 15, 2017 at 04:59:59PM +0800, Aaron Lu wrote: > > v2 changes: Nothing major, only minor ones. > > - rebased on top of v4.11-rc2-mmotm-2017-03-14-15-41; > > - use list_add_tail instead of list_add to add worker to tlb's w

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-16 Thread Alex Thorlton
On Wed, Mar 15, 2017 at 04:59:59PM +0800, Aaron Lu wrote: > v2 changes: Nothing major, only minor ones. > - rebased on top of v4.11-rc2-mmotm-2017-03-14-15-41; > - use list_add_tail instead of list_add to add worker to tlb's worker >list so that when doing flush, the first queued worker gets

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-16 Thread Tim Chen
On Thu, 2017-03-16 at 10:07 +0100, Michal Hocko wrote: > On Wed 15-03-17 14:38:34, Tim Chen wrote: > > > > On Wed, 2017-03-15 at 17:28 +0100, Michal Hocko wrote: > > > > > > On Wed 15-03-17 23:44:07, Aaron Lu wrote: > > > > > > > > > > > > On Wed, Mar 15, 2017 at 03:18:14PM +0100, Michal Hocko

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-16 Thread Aaron Lu
On Thu, Mar 16, 2017 at 09:51:22PM +0800, Aaron Lu wrote: > Considering that we are mostly improving for memory intensive apps, the > default setting should probably be: max_active = node_number with each > worker freeing 2G memory. In case people want to give this setting a try, here is what to d

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-16 Thread Aaron Lu
On Thu, Mar 16, 2017 at 03:34:03PM +0800, Aaron Lu wrote: > On Wed, Mar 15, 2017 at 05:28:43PM +0100, Michal Hocko wrote: > ... ... > > After all the amount of the work to be done is the same we just risk > > more lock contentions, unexpected CPU usage etc. > > I start to realize this is a good qu

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-16 Thread Michal Hocko
On Wed 15-03-17 14:38:34, Tim Chen wrote: > On Wed, 2017-03-15 at 17:28 +0100, Michal Hocko wrote: > > On Wed 15-03-17 23:44:07, Aaron Lu wrote: > > > > > > On Wed, Mar 15, 2017 at 03:18:14PM +0100, Michal Hocko wrote: > > > > > > > > On Wed 15-03-17 16:59:59, Aaron Lu wrote: > > > > [...] > > >

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-16 Thread Aaron Lu
On Wed, Mar 15, 2017 at 05:28:43PM +0100, Michal Hocko wrote: ... ... > After all the amount of the work to be done is the same we just risk > more lock contentions, unexpected CPU usage etc. I start to realize this is a good question. I guess max_active=4 produced almost the best result(max_acti

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-15 Thread Aaron Lu
On Wed, Mar 15, 2017 at 05:28:43PM +0100, Michal Hocko wrote: > On Wed 15-03-17 23:44:07, Aaron Lu wrote: > > On Wed, Mar 15, 2017 at 03:18:14PM +0100, Michal Hocko wrote: > > > On Wed 15-03-17 16:59:59, Aaron Lu wrote: > > > [...] > > > > The proposed parallel free did this: if the process has man

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-15 Thread Tim Chen
On Wed, 2017-03-15 at 17:28 +0100, Michal Hocko wrote: > On Wed 15-03-17 23:44:07, Aaron Lu wrote: > > > > On Wed, Mar 15, 2017 at 03:18:14PM +0100, Michal Hocko wrote: > > > > > > On Wed 15-03-17 16:59:59, Aaron Lu wrote: > > > [...] > > > > > > > > The proposed parallel free did this: if the p

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-15 Thread Michal Hocko
On Wed 15-03-17 23:44:07, Aaron Lu wrote: > On Wed, Mar 15, 2017 at 03:18:14PM +0100, Michal Hocko wrote: > > On Wed 15-03-17 16:59:59, Aaron Lu wrote: > > [...] > > > The proposed parallel free did this: if the process has many pages to be > > > freed, accumulate them in these struct mmu_gather_ba

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-15 Thread Aaron Lu
On Wed, Mar 15, 2017 at 03:56:02PM +0100, Vlastimil Babka wrote: > On 03/15/2017 09:59 AM, Aaron Lu wrote: > > For regular processes, the time taken in its exit() path to free its > > used memory is not a problem. But there are heavy ones that consume > > several Terabytes memory and the time taken

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-15 Thread Aaron Lu
On Wed, Mar 15, 2017 at 03:18:14PM +0100, Michal Hocko wrote: > On Wed 15-03-17 16:59:59, Aaron Lu wrote: > [...] > > The proposed parallel free did this: if the process has many pages to be > > freed, accumulate them in these struct mmu_gather_batch(es) one after > > another till 256K pages are ac

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-15 Thread Vlastimil Babka
On 03/15/2017 09:59 AM, Aaron Lu wrote: > For regular processes, the time taken in its exit() path to free its > used memory is not a problem. But there are heavy ones that consume > several Terabytes memory and the time taken to free its memory in its > exit() path could last more than ten minutes

Re: [PATCH v2 0/5] mm: support parallel free of memory

2017-03-15 Thread Michal Hocko
On Wed 15-03-17 16:59:59, Aaron Lu wrote: [...] > The proposed parallel free did this: if the process has many pages to be > freed, accumulate them in these struct mmu_gather_batch(es) one after > another till 256K pages are accumulated. Then take this singly linked > list starting from tlb->local.

[PATCH v2 0/5] mm: support parallel free of memory

2017-03-15 Thread Aaron Lu
For regular processes, the time taken in its exit() path to free its used memory is not a problem. But there are heavy ones that consume several Terabytes memory and the time taken to free its memory in its exit() path could last more than ten minutes if THP is not used. As Dave Hansen explained w