From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 281B9C433E0 for ; Thu, 11 Feb 2021 21:26:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 843B064E42 for ; Thu, 11 Feb 2021 21:26:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 843B064E42 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0B0098D0005; Thu, 11 Feb 2021 16:26:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 03A678D0002; Thu, 11 Feb 2021 16:26:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E1DD98D0005; Thu, 11 Feb 2021 16:26:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0074.hostedemail.com [216.40.44.74]) by kanga.kvack.org (Postfix) with ESMTP id C96208D0002 for ; Thu, 11 Feb 2021 16:26:49 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 8EB05181AEF3C for ; Thu, 11 Feb 2021 21:26:49 +0000 (UTC) X-FDA: 77807271738.22.wine53_45132082761b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 6B4FD18037388 for ; Thu, 11 Feb 2021 21:26:49 +0000 (UTC) X-HE-Tag: wine53_45132082761b X-Filterd-Recvd-Size: 2167 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Thu, 11 Feb 2021 21:26:48 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D5EFBAE91; Thu, 11 Feb 2021 21:26:47 +0000 (UTC) Date: Thu, 11 Feb 2021 22:26:45 +0100 From: Oscar Salvador To: akpm@linux-foundation.org Cc: hannes@cmpxchg.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: workingset: clarify eviction order and distance calculation Message-ID: <20210211212645.GB2872@localhost.localdomain> References: <20210201060651.3781-1-osalvador@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210201060651.3781-1-osalvador@suse.de> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000014, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Feb 01, 2021 at 07:06:51AM +0100, Oscar Salvador wrote: > The premise of the refault distance is that it can be seen as a deficit > of the inactive list space, so that if the inactive list would have had > (R - E) more slots, the page would not have been evicted but promoted > to the active list instead. > > However, the way the code is ordered right now set us to be off by one, > so the real number of slots would be (R - E) + 1. > I stumbled upon this when trying to understand the code and it puzzled me > that the comments did not match what the code did. > > This it not an issue at all since evictions and refaults tend to happen > in a number large enough that being off-by-one does not have any impact > - and since the compiler and CPUs are free to rearrange the execution > sequence anyway. > But as Johannes says, it is better to re-arrange the code in the proper > order since otherwise would be misleading to somebody who is actively > reading and trying to understand the logic of the code - like it > happened to me. > > Signed-off-by: Oscar Salvador > Acked-by: Johannes Weiner Hi Andrew, is this on your radar? Thanks! -- Oscar Salvador SUSE L3