Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp626527rwj; Thu, 22 Dec 2022 12:18:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXu3GOPkZCCqvL415wyPJoZH/JVys1uvZdoUn/7Dnmr9xqNsbAFW45SPUX31UwvJQ4Yw/JBb X-Received: by 2002:a17:90a:3f82:b0:218:12e7:3f8f with SMTP id m2-20020a17090a3f8200b0021812e73f8fmr23302457pjc.9.1671740298654; Thu, 22 Dec 2022 12:18:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671740298; cv=none; d=google.com; s=arc-20160816; b=pvyQIh8snctLvWZbIqtQqAfxvKGaNcg7br27OKsOOHnRY7nJInTsznbZuwZUgHra/A Gl3X+m/k0NMH5kccOEG9+vGuKMpmlS85+uwHBU/L8h6eTz/qHORGrJm0WAefY0igsuC3 IRBqzdToBqZnDps9gc3zTLPniR3cOR+ZP788xg1IwahO6nM/LjABKaRb6foPVrPJb3oz L+c1LF1ydmyEWsXiS2vSM2efJo/1eWBwTy9VD5woThzDVazLqXK2rvjVFlDKBgimYgJx m/IuyKoa/rL61aoboMAUp5mVAVd3I5dyo7VETj9LqfLy5eZjPnpSwQbTwVnJS7zvuyHJ EBow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=g2pmAFCGG/GkprLUyNP1SWGbkG4SkcqSGKIUA+ilYYY=; b=Y/8I7iBJ/ikj6avtEGrntcB6w+fq4HrAnTUWgvJdMMU2VBWhkScOvTylFDOMupe37c 2V5fU207PPzcCvhbX8t+SM81zfD5dnP8+nIIZICE23hKPY6PeNo9jN/fRop6hDZDS/fm u81Z/jBLCwbw08XTi9jmmgrKNnNmC3New1xw5q6I2VxjGtu5GXOMeNpyotjHc0ztwBs2 Zcd3tTTYi7rq392Ymx2QNJ5Yn9lAZxgD8z0Q4RugATdFjR2YEHLMKkSihaujY4QyVhpn zrHcg52zYcOR71NQr/K/jvWjcWBr0x745YdN53aNDgpoFd9LVwYio/UVGOZ7JcPeTKoK kfkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=lJQbq1cj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y5-20020a17090a134500b0021945f60e1asi1526501pjf.61.2022.12.22.12.18.09; Thu, 22 Dec 2022 12:18:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=lJQbq1cj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235802AbiLVTpR (ORCPT + 68 others); Thu, 22 Dec 2022 14:45:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235773AbiLVTpO (ORCPT ); Thu, 22 Dec 2022 14:45:14 -0500 Received: from mail-ua1-x932.google.com (mail-ua1-x932.google.com [IPv6:2607:f8b0:4864:20::932]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE1781789B for ; Thu, 22 Dec 2022 11:45:12 -0800 (PST) Received: by mail-ua1-x932.google.com with SMTP id f25so624845uaa.3 for ; Thu, 22 Dec 2022 11:45:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=g2pmAFCGG/GkprLUyNP1SWGbkG4SkcqSGKIUA+ilYYY=; b=lJQbq1cjQrhpT5gOQ48YcaZ99RlKBG8zn4rLrJViTnXXV0/N6DlHZaK/DnfSRGpvY6 tbLfdqHJJElRh/9IegWQIZORipwpZYgdw53aYe5UgjrJwj9KBVnpyE1AEPZ2b7MHBhfB y84ZdO5dguqeoWcRy3bX07BSQWgoh36brbeTvDIFLjB3KnSx8LGOQGaaorhoZ75LAvrd dqWnQ4RAr+YV+7bkff2V1Z4zY9pN5gbu0c2O9raCZxubnCMcW2eSMuvXk3qkplHjXPX4 jZjlhLjjnMBTWwpgkoTTYTX248jyEJ/+h/5MGi3vwMHZO3uJJVgxC3pGEdTc128vTLQA XxNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=g2pmAFCGG/GkprLUyNP1SWGbkG4SkcqSGKIUA+ilYYY=; b=BbPmCgb04tfKPYLEHYfns0sj3HX3UIfSouiKTgBZAgnZzeXhQBQAJy79nVWcn2hUvp 6rY7ZaA8q9k3pmMtL5S/ZGVV5b1SnMRRo1CAOwUlwN+dabx2qMNg6Al/vgfOBL0emtRj j+2F3k8v2A24CAMX3k3+f9lpzc7pDtSnPvUtmPxurkBYXav1Tb2zKhA/JxCJZwUPIuRx aoiaDpF6fFrI68Qt7bsLOcEhF6hdp9CP2EkOFIOfUqTmIzUJF+KCVoK2zEK/Z80MyEou ko7SsazkR0sPD4UF5mxQ/9q5K1y2yAdZWE84gFQMGHq/ArjOIYg0FZRJrejzM/0pDfiT USZw== X-Gm-Message-State: AFqh2kpE3nREEd7glELvDZtAMRbTwm/6d5Q9gwad/glIeS1M7hrCifCB pmb/rFerfuLM1bejzqC+ZdTyaUWsrXwzAaqNoxOMYA== X-Received: by 2002:ab0:21c1:0:b0:3c7:9fbd:a455 with SMTP id u1-20020ab021c1000000b003c79fbda455mr713425uan.113.1671738311648; Thu, 22 Dec 2022 11:45:11 -0800 (PST) MIME-Version: 1.0 References: <20221222061341.381903-1-yuanchu@google.com> <20221222104937.795d2a134ac59c8244d9912c@linux-foundation.org> In-Reply-To: <20221222104937.795d2a134ac59c8244d9912c@linux-foundation.org> From: Yu Zhao Date: Thu, 22 Dec 2022 12:44:35 -0700 Message-ID: Subject: Re: [PATCH 1/2] mm: add vma_has_locality() To: Andrew Morton Cc: Yuanchu Xie , Ivan Babrou , Johannes Weiner , Alexander Viro , Steven Barrett , Brian Geffon , Oleksandr Natalenko , Suren Baghdasaryan , Arnd Bergmann , Peter Xu , Hugh Dickins , Gaosheng Cui , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 22, 2022 at 11:49 AM Andrew Morton wrote: > > On Wed, 21 Dec 2022 22:13:40 -0800 Yuanchu Xie wrote: > > > From: Yu Zhao This works; suggested-by probably works even better, since I didn't do the follow-up work. > > Currently in vm_flags in vm_area_struct, both VM_SEQ_READ and > > VM_RAND_READ indicate a lack of locality in accesses to the vma. Some > > places that check for locality are missing one of them. We add > > vma_has_locality to replace the existing locality checks for clarity. > > I'm all confused. Surely VM_SEQ_READ implies locality and VM_RAND_READ > indicates no-locality? Spatially, yes. But we focus more on the temporal criteria here, i.e., the reuse of an area within a relatively small duration. Both the active/inactive LRU and MGLRU rely on this. VM_SEQ_READ, while being a special case of spatial locality, fails the temporal criteria. VM_RAND_READ fails both criterias, obviously. Once an area passes the temporal criteria, MGLRU additionally exploits spatial locality by lru_gen_look_around(), which is also touched in this patch. This part is good to know but not really relevant here.