Received: by 10.223.176.5 with SMTP id f5csp4115477wra; Tue, 30 Jan 2018 02:19:06 -0800 (PST) X-Google-Smtp-Source: AH8x227J4134yqGlVIu7z1xa6rbPYlf8kxvMu3fVoLfTkAD68c/sc5U71WEHqrIzbQKziIQdt/Xb X-Received: by 10.101.82.1 with SMTP id o1mr23254889pgp.259.1517307546780; Tue, 30 Jan 2018 02:19:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517307546; cv=none; d=google.com; s=arc-20160816; b=ODTVtaRF7Gw/j7DlpMtlOnyHEBwVuDpUU75v6HcMjH8859CJXHoPa8vSHVG8qyz5Gm NBRGwSGwXgO3vyRYnNHuQPG59co0MhdtWEDViLjIcikPkhsCIEsh5sBpIKfaZSf285E3 JmEnBSga3RMxfegrneMyH/Jtp09iiNrV0pdZjsqxiD5MKumi0DvaMAd0zoYoZZRqujfm 7GcX76t7wuUDzua0oSzY3NH3izdgTal9OXZ6gbMvNgyHmoserZYwUwlLpfq49rGGQN0y H3gZxIHoQHQDSmRNIB1ZxSmPOzMo/JdC3uKA/BNiHvOoaJuCMK/REeBFnXeLzaffVnB0 un0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=R6ATDwbP+ZgezU4MWxe+V8dZGDIWTAbVVvXxcPqE4Es=; b=UUo2L76DFDMM7nCPhGBBFtcHMCqt0X9SXMlE05t6JGQJJsdn9KUxpzDmDeb7yJ7xhg mBr9QSm1nbBJppvmIR2UBQ/Kf6yv012nrlxpldM8k5YsFmdvV9+Kb4bwFtexcXGGU2+7 tgcWz6qpqq629X57S3xfdOdAb0Viv+Isoy9MphqnyuTw18Z5rQ504ZI8qBegflatvhWH ro5E64yXAVgVvZ2DsHcfOj2BCvwBPClDZ8m0QdnFzSJMWdPsAF0UW2kAh2dKX6oDA6Eo k3ey1A5haKXSAmQkDfQm7eUrMChySy/W4dD9gvtx1/i5hhE7pt1fiTlWsZqtORjKIG/a JSjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3si9081903pgf.60.2018.01.30.02.18.52; Tue, 30 Jan 2018 02:19:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751563AbeA3KS1 (ORCPT + 99 others); Tue, 30 Jan 2018 05:18:27 -0500 Received: from mx2.suse.de ([195.135.220.15]:41480 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751273AbeA3KS0 (ORCPT ); Tue, 30 Jan 2018 05:18:26 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 80FD8AD72; Tue, 30 Jan 2018 10:18:24 +0000 (UTC) Date: Tue, 30 Jan 2018 11:18:23 +0100 From: Michal Hocko To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: "He, Roger" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" Subject: Re: [PATCH] mm/swap: add function get_total_swap_pages to expose total_swap_pages Message-ID: <20180130101823.GX21609@dhcp22.suse.cz> References: <1517214582-30880-1-git-send-email-Hongbo.He@amd.com> <20180129163114.GH21609@dhcp22.suse.cz> <20180130075553.GM21609@dhcp22.suse.cz> <9060281e-62dd-8775-2903-339ff836b436@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9060281e-62dd-8775-2903-339ff836b436@amd.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 many the swap cache > > > it can use to prevent triggering OOM. For Now we set the threshold of > > > swap size TTM used as 1/2 * total size and leave the rest for others > > > use. > > Why do you so much memory? Are you going to use TB of memory on large > > systems? What about memory hotplug when the memory is added/released? > > For graphics and compute applications on GPUs it isn't unusual to use large > amounts of system memory. > > Our standard policy in TTM is to allow 50% of system memory to be pinned for > use with GPUs (the hardware can't do page faults). > > When that limit is exceeded (or the shrinker callbacks tell us to make room) > we wait for any GPU work to finish and copy buffer content into a shmem > file. > > This copy into a shmem file can easily trigger the OOM killer if there isn't > any swap space left and that is something we want to avoid. > > So what we want to do is to apply this 50% rule to swap space as well and > deny allocation of buffer objects when it is exceeded. How does that help when the rest of the system might eat swap? > > > But get_nr_swap_pages is the only API we can accessed from other > > > module now. It can't cover the case of the dynamic swap size > > > increment. I mean: user can use "swapon" to enable new swap file or > > > swap disk dynamically or "swapoff" to disable swap space. > > Exactly. Your scaling configuration based on get_nr_swap_pages or the > > available memory simply sounds wrong. > > Why? That is pretty much exactly what we are doing with buffer objects and > system memory for years. Could you be more specific? What kind of buffer objects you have in mind? -- Michal Hocko SUSE Labs