Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp539501ybl; Wed, 14 Aug 2019 02:00:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzH6UO67KW6AArD5kB9dUGccSJ5f3Cb4jinJjx6qUnS5CqqI7hgypV94YxOp3GfUHNG22Vz X-Received: by 2002:a63:3387:: with SMTP id z129mr37729302pgz.177.1565773232913; Wed, 14 Aug 2019 02:00:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565773232; cv=none; d=google.com; s=arc-20160816; b=QZ7T6DdYlD/iM/pKBRE6fPT7dOQxNiXHP0zUNavVcuHkNPsvTYc99m+ypp+BKuPF/v YqEjJhJDMZBP9KOHLBW21MO8FPwNLZWS6I2NY/4GOO0+OfeIggtQgT/HgIFPlzUeh8ja wrS0PGMJkzb3QL6hbmwMBkOvt6KTS+Q2733vnkPSPmX5wcrOrjxFDbsTEsZSt6ZM/wbJ qUStkJsYKMIyjafslVPXi9gmWlgR+eQT2ELXdgMBIpUKVdthxCFlMMkXbHuqiZbQZfxt n4a2cq/xhRPG+iJC+xhGhXZZXcG6VtGvg2AuXjBqKZfRCoqix+wr4xN3Dn7sa0XBX1Nn 6CGg== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=a1CRMf5FGikOsYzfMrj8nPIB+ZsStilAXgFEnTLCc6s=; b=mgM7aIO76/8/2n5fUBlMagvBM+b3Tt4xCJNJLR4tpwnXPyZIJZ/hoJnUZ1WpTOyatt /wE44L2eRyQ2DKgcKmJwhtdSDmydFzADmGc6htLmbZ0qRCLW29bRSnlSvWVvBMEaRkK+ Nk42AmE4Rf9xdCdfWnxfBv9LtD8NivjsNUh/VlOdRg0/j7g/5vzyLKiaUBXVBywltlA1 7U6toiu+pIAIubfqW5DY0+2Y5yH8iT9LTQ4Db0xUWzIorxxIotSqjVS48GT1q3r2Jqle Oo30LOj2hH+zH9WdIl4Y9Kytf+BgJKwoCjp/d7orMhvcHjq/OHQT7yPyeQrhbaiXS3UF VkyQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k67si15569612pgc.26.2019.08.14.02.00.15; Wed, 14 Aug 2019 02:00:32 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726265AbfHNI6h (ORCPT + 99 others); Wed, 14 Aug 2019 04:58:37 -0400 Received: from mx2.suse.de ([195.135.220.15]:50750 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725828AbfHNI6h (ORCPT ); Wed, 14 Aug 2019 04:58:37 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 325FAAD4E; Wed, 14 Aug 2019 08:58:33 +0000 (UTC) Date: Wed, 14 Aug 2019 10:58:31 +0200 From: Michal Hocko To: Khalid Aziz Cc: akpm@linux-foundation.org, vbabka@suse.cz, mgorman@techsingularity.net, dan.j.williams@intel.com, osalvador@suse.de, richard.weiyang@gmail.com, hannes@cmpxchg.org, arunks@codeaurora.org, rppt@linux.vnet.ibm.com, jgg@ziepe.ca, amir73il@gmail.com, alexander.h.duyck@linux.intel.com, linux-mm@kvack.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 0/2] Add predictive memory reclamation and compaction Message-ID: <20190814085831.GS17933@dhcp22.suse.cz> References: <20190813014012.30232-1-khalid.aziz@oracle.com> <20190813140553.GK17933@dhcp22.suse.cz> <3cb0af00-f091-2f3e-d6cc-73a5171e6eda@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3cb0af00-f091-2f3e-d6cc-73a5171e6eda@oracle.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 13-08-19 09:20:51, Khalid Aziz wrote: > On 8/13/19 8:05 AM, Michal Hocko wrote: > > On Mon 12-08-19 19:40:10, Khalid Aziz wrote: > > [...] > >> Patch 1 adds code to maintain a sliding lookback window of (time, number > >> of free pages) points which can be updated continuously and adds code to > >> compute best fit line across these points. It also adds code to use the > >> best fit lines to determine if kernel must start reclamation or > >> compaction. > >> > >> Patch 2 adds code to collect data points on free pages of various orders > >> at different points in time, uses code in patch 1 to update sliding > >> lookback window with these points and kicks off reclamation or > >> compaction based upon the results it gets. > > > > An important piece of information missing in your description is why > > do we need to keep that logic in the kernel. In other words, we have > > the background reclaim that acts on a wmark range and those are tunable > > from the userspace. The primary point of this background reclaim is to > > keep balance and prevent from direct reclaim. Why cannot you implement > > this or any other dynamic trend watching watchdog and tune watermarks > > accordingly? Something similar applies to kcompactd although we might be > > lacking a good interface. > > > > Hi Michal, > > That is a very good question. As a matter of fact the initial prototype > to assess the feasibility of this approach was written in userspace for > a very limited application. We wrote the initial prototype to monitor > fragmentation and used /sys/devices/system/node/node*/compact to trigger > compaction. The prototype demonstrated this approach has merits. > > The primary reason to implement this logic in the kernel is to make the > kernel self-tuning. What makes this particular self-tuning an universal win? In other words there are many ways to analyze the memory pressure and feedback it back that I can think of. It is quite likely that very specific workloads would have very specific demands there. I have seen cases where are trivial increase of min_free_kbytes to normally insane value worked really great for a DB workload because the wasted memory didn't matter for example. > The more knobs we have externally, the more complex > it becomes to tune the kernel externally. I agree on this point. Is the current set of tunning sufficient? What would be missing if not? -- Michal Hocko SUSE Labs