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
27; 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 memory, it can pass. But when run with platform with 16GB system memory, it

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

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
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 suggested before. E.g. don't copy anything into a shme

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

2018-01-31 Thread He, Roger
g; 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 currentbuffer storage cannot be reclaimed. So you

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

2018-01-31 Thread He, Roger
.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 suggested before. E.g. don't copy anything in

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

2018-01-31 Thread Chunming Zhou
---Original 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 Su

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

2018-01-31 Thread Christian König
ists.freedesktop.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 co

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

2018-01-31 Thread He, Roger
ian 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

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 va

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 gro

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 nee

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 us

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 how

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 t

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 a

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

2018-01-29 Thread He, Roger
@vger.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

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

2018-01-29 Thread He, Roger
Hongbo.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: [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(+) > >