Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1721472yba; Thu, 4 Apr 2019 17:16:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwBNdHFwfPmFb863RyhbYe64sQnBchratOQwmj4nOObOGhz2Fc5xn1Jkrnsn6VshoylrlMB X-Received: by 2002:a63:54b:: with SMTP id 72mr8459120pgf.323.1554423390683; Thu, 04 Apr 2019 17:16:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554423390; cv=none; d=google.com; s=arc-20160816; b=UZozT9Zu1yRRaH4jITJv/ykNQ/QjWqKIshhulAjRg2M23FSKdUNO2Psy6+vDpAHwqo /N6xR2kAksDjCJParOEkRR/haEOIISRwBb9ptBERKDXCzZqWeEzDiaEkAhBl0M1LDRxv O0CVh5EEMXMGV7qxFU55m2SILmc7lITyq3mIkK1G4z2heVLx9o/xDxakO/NEKfhI5sNC PtszaSiYyro7kZInCRRYMnWy5L/oFEynaP9nfhadsMWbWn4GgK05D+Y44goBi2AS1Ls7 5wgZ0QQOuXDGaTnvnEPHer5sDl657JAECn7leViRajyokHrk2E5WpOcA1KVUgwZtWqNF rNrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=aQmFptRCMNJUXqWNlG7Ngtr4WD0bD7Lax90R8JIeGM8=; b=K3JOYzeB7v/KMVZzJZShpAXsJ5pibI8s6flltN1OFoUOEpDde5HASGF3/jOT6lJPKr szJ/T1DvF9JwZhbRwPG4gewsJrJqYJze7RRAv5YYWmzzGX0wjiGDS68zkcwKpTTy+gvt AxWlZKv9uYqSUGJryXpOiFocXxkZ2+9xzZRhKUE1I4q8rWrz3h5tVwSsp8m5nvOebWca /jNoWdf+Lu0H7GxCJW5W3+mKGW6YzmE3y7wvDPXaMhqtEnsAkKfG7wdg6AHX5MLv1yVu /4rJERFBmLfMHmCytVLOEAWBl4yEk+9flinI2JyudZWvP8vaaVt+Mqyjwu9qqG32QhYS rElA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NW4GvuGn; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a64si18051512pge.592.2019.04.04.17.15.45; Thu, 04 Apr 2019 17:16:30 -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=@gmail.com header.s=20161025 header.b=NW4GvuGn; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729794AbfDDXX7 (ORCPT + 99 others); Thu, 4 Apr 2019 19:23:59 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:44680 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728211AbfDDXX6 (ORCPT ); Thu, 4 Apr 2019 19:23:58 -0400 Received: by mail-ed1-f68.google.com with SMTP id d11so3787868edp.11 for ; Thu, 04 Apr 2019 16:23:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aQmFptRCMNJUXqWNlG7Ngtr4WD0bD7Lax90R8JIeGM8=; b=NW4GvuGndPKFA7keaygmFDAXwp5CI+w9ZQp3InVI/99p1G8R5xbgp4cTsJRUxSTe9y HByHqPrq2noZJX8O6iPPiKq3Zr+cfKmBtF00K9BrznkKnlum0k7Nwrhx7tyF5NlJOHSV 45LGI+oBdyq/ApcptsqcPK7fsn69vQBkcwAkgYV2vRlBeAlF6VDwjp0AugcTwl3+klQd tdGwINuu9wvyOC52mBvm1EauiZIa4wOiVveh90sz2FGRUpJatBthj+H33uXjhIi/rrUS RB/vIGXyX/bBgOJJFluSzhcCQEfmW6+Jt1NraodcSkK020RD0FSwwSoGcSozRk7NoeCc Z4oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aQmFptRCMNJUXqWNlG7Ngtr4WD0bD7Lax90R8JIeGM8=; b=amVubAPSc6wEBh1QEH8O37/YZCgCbpMu9wJMGvjBJBlS7oZkae820byHyji90kePq1 s0MyOTN6qk7aP6Fd2yVtyhgePRuYKmYwm9/r+PPhG5iqJ+VWZoKAkyofmp9qoCFMW6kQ DkjNd9c4t0+6aK9UrLk/VYlVbbW3IV8jhMXjMiXa17gHD9ol7j+lKPkcP1EATv3XJKPu 9a8a4CffXUSco95tqlVh8ehfgxfnM7hdsVc1fgCL0KLfDor+i5pcXVmcWY6nNnmA+nGb 1zMPeDu7rQnQ2vmY0cNhTAxq362x47c9OhDGbNQ2Svghh8UtihwQ/yVOK+u0jsjZcCzp x/4g== X-Gm-Message-State: APjAAAWMsn2HMabmqfX8co55ZYMQGb9Yga/eRb9JBFsBGjd3eNM+v+je 5DE4dV5kHx8ahO7fcZqEZDVX40UGaRYFWUKap68= X-Received: by 2002:a50:b6d5:: with SMTP id f21mr5626526ede.105.1554420237228; Thu, 04 Apr 2019 16:23:57 -0700 (PDT) MIME-Version: 1.0 References: <1554348617-12897-1-git-send-email-huangzhaoyang@gmail.com> <20190404163914.GA4229@cmpxchg.org> In-Reply-To: <20190404163914.GA4229@cmpxchg.org> From: Zhaoyang Huang Date: Fri, 5 Apr 2019 07:23:46 +0800 Message-ID: Subject: Re: [PATCH] mm:workingset use real time to judge activity of the file page To: Johannes Weiner Cc: Andrew Morton , Vlastimil Babka , Pavel Tatashin , Joonsoo Kim , David Rientjes , Zhaoyang Huang , Roman Gushchin , Jeff Layton , Matthew Wilcox , "open list:MEMORY MANAGEMENT" , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 5, 2019 at 12:39 AM Johannes Weiner wrote: > > On Thu, Apr 04, 2019 at 11:30:17AM +0800, Zhaoyang Huang wrote: > > From: Zhaoyang Huang > > > > In previous implementation, the number of refault pages is used > > for judging the refault period of each page, which is not precised as > > eviction of other files will be affect a lot on current cache. > > We introduce the timestamp into the workingset's entry and refault ratio > > to measure the file page's activity. It helps to decrease the affection > > of other files(average refault ratio can reflect the view of whole system > > 's memory). > > I don't understand what exactly you're saying here, can you please > elaborate? > > The reason it's using distances instead of absolute time is because > the ordering of the LRU is relative and not based on absolute time. > > E.g. if a page is accessed every 500ms, it depends on all other pages > to determine whether this page is at the head or the tail of the LRU. > > So when you refault, in order to determine the relative position of > the refaulted page in the LRU, you have to compare it to how fast that > LRU is moving. The absolute refault time, or the average time between > refaults, is not comparable to what's already in memory. How do you know how long time did these pages' dropping taken.Actruly, a quick dropping of large mount of pages will be wrongly deemed as slow dropping instead of the exact hard situation.That is to say, 100 pages per million second or per second have same impaction on calculating the refault distance, which may cause less protection on this page cache for former scenario and introduce page thrashing. especially when global reclaim, a round of kswapd reclaiming that waked up by a high order allocation or large number of single page allocations may cause such things as all pages within the node are counted in the same lru. This commit can decreasing above things by comparing refault time of single page with avg_refault_time = delta_lru_reclaimed_pages/ avg_refault_retio (refault_ratio = lru->inactive_ages / time).