RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-02-01 Thread He, Roger
ng) <david1.z...@amd.com>; dri-de...@lists.freedesktop.org Cc: linux...@kvack.org; linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages Can you try to use a fixed limit like I suggested once more? E.g. just stop swapping i

RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-02-01 Thread He, Roger
top.org Cc: linux...@kvack.org; linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages Can you try to use a fixed limit like I suggested once more? E.g. just stop swapping if get_nr_swap_pages() < 256MB. Regards, Christian. Am

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-02-01 Thread Christian König
ux...@kvack.org; linux-kernel@vger.kernel.org; 'He, Roger' <hongbo...@amd.com> Subject: RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages Just now, I tried with fixed limit. But not work always. For example: set the limit as 4GB on my platform with 8GB system

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-02-01 Thread Christian König
ect: RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages Just now, I tried with fixed limit. But not work always. For example: set the limit as 4GB on my platform with 8GB system memory, it can pass. But when run with platform with 16GB system memory, it failed si

RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-02-01 Thread He, Roger
koe...@amd.com>; Zhou, David(ChunMing) <david1.z...@amd.com>; dri-de...@lists.freedesktop.org Cc: linux...@kvack.org; linux-kernel@vger.kernel.org; 'He, Roger' <hongbo...@amd.com> Subject: RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages Just now,

RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-02-01 Thread He, Roger
(ChunMing) ; dri-de...@lists.freedesktop.org Cc: linux...@kvack.org; linux-kernel@vger.kernel.org; 'He, Roger' Subject: RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages Just now, I tried with fixed limit. But not work always. For example: set the limit as 4GB

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-02-01 Thread Michal Hocko
On Thu 01-02-18 06:13:20, He, Roger wrote: > Hi Michal: > > How about only > EXPORT_SYMBOL_GPL(total_swap_pages) ? I've already expressed that messing up with the amount of swap pages is a wrong approach. You should scale your additional buffers according the the current memory pressure. There

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-02-01 Thread Michal Hocko
On Thu 01-02-18 06:13:20, He, Roger wrote: > Hi Michal: > > How about only > EXPORT_SYMBOL_GPL(total_swap_pages) ? I've already expressed that messing up with the amount of swap pages is a wrong approach. You should scale your additional buffers according the the current memory pressure. There

RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-02-01 Thread He, Roger
;david1.z...@amd.com>; dri-de...@lists.freedesktop.org Cc: linux...@kvack.org; linux-kernel@vger.kernel.org Subject: RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages But what we could do is to rely on a fixed limit like the Intel driver does and I sugg

RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-02-01 Thread He, Roger
...@kvack.org; linux-kernel@vger.kernel.org Subject: RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages But what we could do is to rely on a fixed limit like the Intel driver does and I suggested before. E.g. don't copy anything into a shmemfile when

RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-31 Thread He, Roger
k.org; linux-kernel@vger.kernel.org; dri-de...@lists.freedesktop.org Subject: RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages I do think you should completely ignore the size of the swap space. IMHO you should forbid further allocations when your current

RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-31 Thread He, Roger
...@lists.freedesktop.org Subject: RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages I do think you should completely ignore the size of the swap space. IMHO you should forbid further allocations when your currentbuffer storage cannot be reclaimed. So you need some

RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-31 Thread He, Roger
...@amd.com>; dri-de...@lists.freedesktop.org Cc: linux...@kvack.org; linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages Yeah, indeed. But what we could do is to rely on a fixed limit like the Intel driver does and I suggeste

RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-31 Thread He, Roger
Cc: linux...@kvack.org; linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages Yeah, indeed. But what we could do is to rely on a fixed limit like the Intel driver does and I suggested before. E.g. don't copy anything into a shmem

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-31 Thread Chunming Zhou
t;christian.koe...@amd.com> Subject: Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages Hi Roger, I think this patch isn't need at all. You can directly read total_swap_pages variable in TTM. See the comment: /* protected with swap_lock. reading in

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-31 Thread Chunming Zhou
l Message- From: dri-devel [mailto:dri-devel-boun...@lists.freedesktop.org] On Behalf Of Chunming Zhou Sent: Wednesday, January 31, 2018 3:15 PM To: He, Roger ; dri-de...@lists.freedesktop.org Cc: linux...@kvack.org; linux-kernel@vger.kernel.org; Koenig, Christian Subject: Re:

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-31 Thread Christian König
.@lists.freedesktop.org Cc: linux...@kvack.org; linux-kernel@vger.kernel.org; Koenig, Christian <christian.koe...@amd.com> Subject: Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages Hi Roger, I think this patch isn't need at all. You can directly read total_

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-31 Thread Christian König
esktop.org Cc: linux...@kvack.org; linux-kernel@vger.kernel.org; Koenig, Christian Subject: Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages Hi Roger, I think this patch isn't need at all. You can directly read total_swap_pages variable in TTM. See the comment: /* prot

RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-31 Thread He, Roger
nel.org; Koenig, Christian <christian.koe...@amd.com> Subject: Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages Hi Roger, I think this patch isn't need at all. You can directly read total_swap_pages variable in TTM. See the comment: /* protected with sw

RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-31 Thread He, Roger
Subject: Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages Hi Roger, I think this patch isn't need at all. You can directly read total_swap_pages variable in TTM. See the comment: /* protected with swap_lock. reading in vm_swap_full() doesn't need lock */ l

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-30 Thread Chunming Zhou
Hi Roger, I think this patch isn't need at all. You can directly read total_swap_pages variable in TTM. See the comment: /* protected with swap_lock. reading in vm_swap_full() doesn't need lock */ long total_swap_pages; there are many places using it directly, you just couldn't change its

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-30 Thread Chunming Zhou
Hi Roger, I think this patch isn't need at all. You can directly read total_swap_pages variable in TTM. See the comment: /* protected with swap_lock. reading in vm_swap_full() doesn't need lock */ long total_swap_pages; there are many places using it directly, you just couldn't change its

RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-30 Thread He, Roger
...@amd.com>; linux...@kvack.org; linux-kernel@vger.kernel.org; dri-de...@lists.freedesktop.org Subject: Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages On Tue 30-01-18 11:32:49, Christian König wrote: > Am 30.01.2018 um 11:18 schrieb Michal Hocko: >

RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-30 Thread He, Roger
kernel.org; dri-de...@lists.freedesktop.org Subject: Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages On Tue 30-01-18 11:32:49, Christian König wrote: > Am 30.01.2018 um 11:18 schrieb Michal Hocko: > > On Tue 30-01-18 10:00:07, Christian König wrote: > >

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-30 Thread Christian König
Am 30.01.2018 um 13:28 schrieb Michal Hocko: I do think you should completely ignore the size of the swap space. IMHO you should forbid further allocations when your current buffer storage cannot be reclaimed. So you need some form of feedback mechanism that would tell you: "Your buffers have

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-30 Thread Christian König
Am 30.01.2018 um 13:28 schrieb Michal Hocko: I do think you should completely ignore the size of the swap space. IMHO you should forbid further allocations when your current buffer storage cannot be reclaimed. So you need some form of feedback mechanism that would tell you: "Your buffers have

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-30 Thread Michal Hocko
On Tue 30-01-18 11:32:49, Christian König wrote: > Am 30.01.2018 um 11:18 schrieb Michal Hocko: > > On Tue 30-01-18 10:00:07, Christian König wrote: > > > Am 30.01.2018 um 08:55 schrieb Michal Hocko: > > > > On Tue 30-01-18 02:56:51, He, Roger wrote: > > > > > Hi Michal: > > > > > > > > > > We

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-30 Thread Michal Hocko
On Tue 30-01-18 11:32:49, Christian König wrote: > Am 30.01.2018 um 11:18 schrieb Michal Hocko: > > On Tue 30-01-18 10:00:07, Christian König wrote: > > > Am 30.01.2018 um 08:55 schrieb Michal Hocko: > > > > On Tue 30-01-18 02:56:51, He, Roger wrote: > > > > > Hi Michal: > > > > > > > > > > We

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-30 Thread Christian König
Am 30.01.2018 um 11:18 schrieb Michal Hocko: On Tue 30-01-18 10:00:07, Christian König wrote: Am 30.01.2018 um 08:55 schrieb Michal Hocko: On Tue 30-01-18 02:56:51, He, Roger wrote: Hi Michal: We need a API to tell TTM module the system totally has how many swap cache. Then TTM module can

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-30 Thread Christian König
Am 30.01.2018 um 11:18 schrieb Michal Hocko: On Tue 30-01-18 10:00:07, Christian König wrote: Am 30.01.2018 um 08:55 schrieb Michal Hocko: On Tue 30-01-18 02:56:51, He, Roger wrote: Hi Michal: We need a API to tell TTM module the system totally has how many swap cache. Then TTM module can

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-30 Thread Michal Hocko
On Tue 30-01-18 10:00:07, Christian König wrote: > Am 30.01.2018 um 08:55 schrieb Michal Hocko: > > On Tue 30-01-18 02:56:51, He, Roger wrote: > > > Hi Michal: > > > > > > We need a API to tell TTM module the system totally has how many swap > > > cache. Then TTM module can use it to restrict

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-30 Thread Michal Hocko
On Tue 30-01-18 10:00:07, Christian König wrote: > Am 30.01.2018 um 08:55 schrieb Michal Hocko: > > On Tue 30-01-18 02:56:51, He, Roger wrote: > > > Hi Michal: > > > > > > We need a API to tell TTM module the system totally has how many swap > > > cache. Then TTM module can use it to restrict

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-30 Thread Christian König
Am 30.01.2018 um 08:55 schrieb Michal Hocko: On Tue 30-01-18 02:56:51, He, Roger wrote: Hi Michal: We need a API to tell TTM module the system totally has how many swap cache. Then TTM module can use it to restrict how many the swap cache it can use to prevent triggering OOM. For Now we set

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-30 Thread Christian König
Am 30.01.2018 um 08:55 schrieb Michal Hocko: On Tue 30-01-18 02:56:51, He, Roger wrote: Hi Michal: We need a API to tell TTM module the system totally has how many swap cache. Then TTM module can use it to restrict how many the swap cache it can use to prevent triggering OOM. For Now we set

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-29 Thread Michal Hocko
On Tue 30-01-18 02:56:51, He, Roger wrote: > Hi Michal: > > We need a API to tell TTM module the system totally has how many swap > cache. Then TTM module can use it to restrict how many the swap cache > it can use to prevent triggering OOM. For Now we set the threshold of > swap size TTM used

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-29 Thread Michal Hocko
On Tue 30-01-18 02:56:51, He, Roger wrote: > Hi Michal: > > We need a API to tell TTM module the system totally has how many swap > cache. Then TTM module can use it to restrict how many the swap cache > it can use to prevent triggering OOM. For Now we set the threshold of > swap size TTM used

RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-29 Thread He, Roger
..@kvack.org; linux-kernel@vger.kernel.org; dri-de...@lists.freedesktop.org; Koenig, Christian <christian.koe...@amd.com> Subject: RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages Hi Michal: We need a API to tell TTM module the system totally has how many swa

RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-29 Thread He, Roger
.kernel.org; dri-de...@lists.freedesktop.org; Koenig, Christian Subject: RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages Hi Michal: We need a API to tell TTM module the system totally has how many swap cache. Then TTM module can use it to restrict how many the s

RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-29 Thread He, Roger
, Christian <christian.koe...@amd.com> Subject: Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages On Mon 29-01-18 16:29:42, Roger He wrote: > ttm module needs it to determine its internal parameter setting. Could you be more specific why? > Sign

RE: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-29 Thread He, Roger
o.He) -Original Message- From: dri-devel [mailto:dri-devel-boun...@lists.freedesktop.org] On Behalf Of Michal Hocko Sent: Tuesday, January 30, 2018 12:31 AM To: He, Roger Cc: linux...@kvack.org; linux-kernel@vger.kernel.org; dri-de...@lists.freedesktop.org; Koenig, Christian Subject: Re:

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-29 Thread Michal Hocko
On Mon 29-01-18 16:29:42, Roger He wrote: > ttm module needs it to determine its internal parameter setting. Could you be more specific why? > Signed-off-by: Roger He > --- > include/linux/swap.h | 6 ++ > mm/swapfile.c| 15 +++ > 2 files changed, 21

Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages

2018-01-29 Thread Michal Hocko
On Mon 29-01-18 16:29:42, Roger He wrote: > ttm module needs it to determine its internal parameter setting. Could you be more specific why? > Signed-off-by: Roger He > --- > include/linux/swap.h | 6 ++ > mm/swapfile.c| 15 +++ > 2 files changed, 21 insertions(+) > >