Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1831156yba; Thu, 4 Apr 2019 20:25:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkNWgJPYhpacIKBQ/8ipBh9WnUA8L/SHqsSwnmcHIF63PVvdd/a5tK4PaNZHgqrQNLUM7M X-Received: by 2002:a63:2208:: with SMTP id i8mr9385207pgi.223.1554434714173; Thu, 04 Apr 2019 20:25:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554434714; cv=none; d=google.com; s=arc-20160816; b=uUHQPm42/xjE8N6plFubmL1m4H57i4DSG1oAHjRHZu5HDH6MIRNDjB+L8xMk8FZ4uc RCkVvkT/RCQFg/ya3Z28Tld3iij818PmXO6P3QmIWXPPciwqv2Xpjh1z45aahvCpSFUO rByhRtTFoY5sMUNyB0oYVPSwNgF1vE1MQ7+NbGy4y7IubRwdTMSpazgF3UmSQaoup27J yx4763qkItWViuDpfUzIM03GFclzYAFW96jmqLF2k2KbtTpf10N0NOxku44DlJJQxW/A upc423dy+xYOYIWNGThclKhO9Q55cl/Xik4RlcfnnHQaY2efJk1DakVJGc7fKGfuwFwe SE9A== 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:dkim-signature; bh=sEHuoVGsEvBgCKf3iCMGNhptzBAFaANekywuYd6WFbI=; b=AtBWIgWkaU8Sl2cMLFHMxoNfHzHmyq5r+LO5rTqrSWaxrCsylJiehDS5vzUiRFMopo G1fZVaZxHzGVDhkwFfZSEBunClpJlxNykvjk1C8ac8mjACS1wzt1u0STeWkyi5um+dJT Me8ICNHFM9osxqA1TYz4rwD5dRHQ1jZIJu6QMGiKY+moNHnzGRwnkHxt8nL+abdRG6EL uPzODaQ+SeOMQ84TSQP62khdUQpupklUJoAGDDUxHFhMa9R4Bl7odjnBsahS5bveNp6T Gr57Fc2Pd0GoNaTwQGDHntDt986YUdGaoFOUZMGl73lZ/E96E1+3joT77JfYQTrjj1a0 ANsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@infradead.org header.s=bombadil.20170209 header.b=ZhtaXoCh; 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 70si18252502ple.294.2019.04.04.20.24.56; Thu, 04 Apr 2019 20:25:14 -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=neutral (body hash did not verify) header.i=@infradead.org header.s=bombadil.20170209 header.b=ZhtaXoCh; 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 S1729792AbfDEDYQ (ORCPT + 99 others); Thu, 4 Apr 2019 23:24:16 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48636 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728735AbfDEDYQ (ORCPT ); Thu, 4 Apr 2019 23:24:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=jRHLGjsSpnMNMqpwFJNevcBN06h08Z51JVnzqEP2O/c=; b=ZhtaXoChaqGEyYGJ+8LTG64Et w09ibo7DUWHZN6fWYEGKrJfkgdyFOPniXB0biEH02TLCNMa8t9Gdf/iXjhxbN7KDBLQX7OmgA3mrm kJlm3FtIi+rCOHX8Wz8OLrMXkE/lckB0UAkj5bI3bM46u3k/3WInFgqb8TshQnBIevkkJDDvbkJYo /aqvlxJI+Rg/ivvKVNea0RnUdFRln27s2pm3QRHUVUUiGks3U7gDPZbuqLTDM8xPPtDKmjqoa9wlL PyTINlGYH1t4e6e6fUQOUvIsYcFWaa9WP+atJn4qteq62LRcHHQAwcMM/vzUzaHUgxzQ8iXwScpsX 9A02vccPA==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1hCFST-0002pE-Jf; Fri, 05 Apr 2019 03:24:01 +0000 Date: Thu, 4 Apr 2019 20:24:01 -0700 From: Matthew Wilcox To: Zhaoyang Huang Cc: Andrew Morton , Vlastimil Babka , Pavel Tatashin , Joonsoo Kim , David Rientjes , Zhaoyang Huang , Roman Gushchin , Jeff Layton , Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm:workingset use real time to judge activity of the file page Message-ID: <20190405032401.GN22763@bombadil.infradead.org> References: <1554348617-12897-1-git-send-email-huangzhaoyang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1554348617-12897-1-git-send-email-huangzhaoyang@gmail.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 Thu, Apr 04, 2019 at 11:30:17AM +0800, Zhaoyang Huang wrote: > +++ b/mm/workingset.c > @@ -159,7 +159,7 @@ > NODES_SHIFT + \ > MEM_CGROUP_ID_SHIFT) > #define EVICTION_MASK (~0UL >> EVICTION_SHIFT) > - > +#define EVICTION_JIFFIES (BITS_PER_LONG >> 3) > /* > * Eviction timestamps need to be able to cover the full range of > * actionable refaults. However, bits are tight in the radix tree > @@ -175,18 +175,22 @@ static void *pack_shadow(int memcgid, pg_data_t *pgdat, unsigned long eviction) > eviction >>= bucket_order; > eviction = (eviction << MEM_CGROUP_ID_SHIFT) | memcgid; > eviction = (eviction << NODES_SHIFT) | pgdat->node_id; > + eviction = (eviction << EVICTION_JIFFIES) | (jiffies >> EVICTION_JIFFIES); > eviction = (eviction << RADIX_TREE_EXCEPTIONAL_SHIFT); ... this isn't against current, or even 5.0. > entry >>= RADIX_TREE_EXCEPTIONAL_SHIFT; > + entry >>= EVICTION_JIFFIES; > + prev_jiff = (entry & ((1UL << EVICTION_JIFFIES) - 1)) << EVICTION_JIFFIES; These two lines are in the wrong order. So you're getting (effectively) a random answer in your 'prev_jiff', which means your testing isn't thorough enough. I suspect you're only testing cases you're expecting to improve, and you aren't testing to make sure that other cases don't regress.