Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1218416ybl; Tue, 13 Aug 2019 09:08:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNJ72Ek4Fv0nWdS1M+65smYBdMMh0IvCXE2oOaIhf0cJS+PfOroN0wUxBHgN7jdBTLu2rO X-Received: by 2002:a17:90a:ca0f:: with SMTP id x15mr2838435pjt.82.1565712483808; Tue, 13 Aug 2019 09:08:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565712483; cv=none; d=google.com; s=arc-20160816; b=Rm6ZlU+JhTH++xI0UMp55TotE1IoGgrM1FueKS3kEQjvd0iY4I2xuet/ozdIffth4M QMXaHBG9dZULJmNuMQ+mUGAgkanyyxdY9Xo0LtHGHKjUHR33uR3NILanLaK/affeGJjV HJba/ZyCTvzEepxDSQLTVrwXDuFQPJL+x34PdRDFxut8mjNW14SS29Yxef52z99/VW8/ vmo0IjI5wwdXbeKz4qt4zvUcb0vj0OUdXyTtJUf7VEm/iCAJezoyShyWIhGu/vGXHKPW UN6D+GyhqVqy805DgNPymYxf+26L/d0jlHQo1fi6VN5GltQbMISfRPLkQhDrZIm9rawP VXYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=3lnMfPd7Gg7c53hK0P9zvawMvp/Er2oWH5wXpSpk/1A=; b=GCvZfBGBwohIt9gmx1f/c5MVSk4NVR8S6KgID4PkPmFRVq4SpuQ1vObIiAgERqo2IU g4DRLnKeXYlh+CMc/aHYvmnKMmieJWW8lN5TAxWvHv7ygUCTwnRsNSmNAP5Wh/tBq2dS jqi9wnrRzYIcEDmDHtXpZq2rDzMt9Y3ZJIbLp22V2A9YeXmi2T2+XqK2AD0LuvopSlsM ktMCHGETwS54wh85EH1VCtDSQvLX+kPJT+hveHXl7sdva2pqCrca/tkdG7IE/XVIMvqJ f4rUsXBUhkNJ3qnH9AYoTcdu9t9NQy2HkKKTjslFrGqAQZj7NFdI1b1+o9/WopQSmf9X bXUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=Cl10+Swp; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s23si63569094pgq.516.2019.08.13.09.07.46; Tue, 13 Aug 2019 09:08:03 -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; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=Cl10+Swp; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729539AbfHMPYU (ORCPT + 99 others); Tue, 13 Aug 2019 11:24:20 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:48588 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727274AbfHMPYU (ORCPT ); Tue, 13 Aug 2019 11:24:20 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7DFE7tL113127; Tue, 13 Aug 2019 15:23:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=3lnMfPd7Gg7c53hK0P9zvawMvp/Er2oWH5wXpSpk/1A=; b=Cl10+SwpcauJ7sUnCom+B5Q1g20dzgbrM+XPg6v26kQrDGDYKCuEh+8gpq0t/aL9k4oN z0LM6r5u2R92SS5vkyS39wcDrFw6OCDd9owxpunhIXJys23Vg2CV1YN0mAD0zN7nZCX+ zAz8x2b4VWT7Eb2HeeLdAf7Li0LFW4wOX0LUXfNGO5RFXvuviY8jHhBCI2R3cHbE8Qhp vAexMpBNPsRRS0k8HEYoSRfZOTjBSUXU76PUil5AyyBTtJ0mXJGUSEhIi2YYqllpXPG5 ImwOsiqTFpEjXHi6C4SwXfSMMJPVZETaW0GBjfB74UJ18HduP1WEd0Nr7nfsZzjyX3Zc jw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 2u9nbtf2y4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Aug 2019 15:23:02 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x7DFDS0K029285; Tue, 13 Aug 2019 15:21:01 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 2ubwqrwbdq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Aug 2019 15:21:01 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x7DFKtnY024258; Tue, 13 Aug 2019 15:20:55 GMT Received: from [10.65.155.174] (/10.65.155.174) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 13 Aug 2019 08:20:54 -0700 Subject: Re: [RFC PATCH 0/2] Add predictive memory reclamation and compaction To: Michal Hocko 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 References: <20190813014012.30232-1-khalid.aziz@oracle.com> <20190813140553.GK17933@dhcp22.suse.cz> From: Khalid Aziz Organization: Oracle Corp Message-ID: <3cb0af00-f091-2f3e-d6cc-73a5171e6eda@oracle.com> Date: Tue, 13 Aug 2019 09:20:51 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190813140553.GK17933@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9348 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908130158 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9348 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908130158 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, numb= er >> 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 th= e >> 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 orde= rs >> 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. >=20 > 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 b= e > lacking a good interface. >=20 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. The more knobs we have externally, the more complex it becomes to tune the kernel externally. If we can make the kernel self-tuning, we can actually eliminate external knobs and simplify kernel admin. Inspite of availability of tuning knobs and large number of tuning guides for databases and cloud platforms, allocation stalls is a routinely occurring problem on customer deployments. A best fit line algorithm shows immeasurable impact on system performance yet provides measurable improvement and room for further refinement. Makes sense? Thanks, Khalid