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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0307AC4332F for ; Thu, 22 Dec 2022 19:45:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 52CBF900003; Thu, 22 Dec 2022 14:45:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B5B8900002; Thu, 22 Dec 2022 14:45:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 35669900003; Thu, 22 Dec 2022 14:45:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2240C900002 for ; Thu, 22 Dec 2022 14:45:16 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B6D00140E9D for ; Thu, 22 Dec 2022 19:45:15 +0000 (UTC) X-FDA: 80270970990.19.F44FAAB Received: from mail-ua1-f46.google.com (mail-ua1-f46.google.com [209.85.222.46]) by imf23.hostedemail.com (Postfix) with ESMTP id A5D7E140019 for ; Thu, 22 Dec 2022 19:45:12 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=lJQbq1cj; spf=pass (imf23.hostedemail.com: domain of yuzhao@google.com designates 209.85.222.46 as permitted sender) smtp.mailfrom=yuzhao@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1671738312; a=rsa-sha256; cv=none; b=Ig3BfhhAyvjJzO3fQXdqzgbhZNhG7Z+3rO+2vQxkecxNpzx5tSK2SYqXZkVUiQCP3pM7N4 c8RC3E5BbZ/kjT5w/XuwBp/LUHaQYSUO2Bi6b/hZDDjG2zHO9JMeIWjKumLsNEsxoKxXkx j97ysz09rvoxCuUf7aMCf5gqQREaAxc= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=lJQbq1cj; spf=pass (imf23.hostedemail.com: domain of yuzhao@google.com designates 209.85.222.46 as permitted sender) smtp.mailfrom=yuzhao@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1671738312; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=g2pmAFCGG/GkprLUyNP1SWGbkG4SkcqSGKIUA+ilYYY=; b=3sZMshfF36uvOUfeTSkFWdeTctPNUrjaCAr6MGnygw2k/fZIOEhpR0znyEOFNvWNMCmp2e QSZU32jWasRTf13VBcVD2dZwJa35+3O28pE3WqrxyR3GisqE/HHW7jR2S7EhJEkndDqRUE b9HyDwudu1mMSlxkpABCrIhR6j0pOsE= Received: by mail-ua1-f46.google.com with SMTP id e24so618347uam.10 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=bKuFQotNqzCFbk+dArPAnknd98EKa74bptXit/d+NTVMyH5laRL0czzAga4WkNlPbP lY6QqnzWbxeoVnr6XxEQFfrwjmJb8PMSHT2xvCnIrNltvsidbnQWa0Cns2zWY3b4QJVL x9QTchfgptHbWfh+BGOxbD6BaIjCajcFOcNocWQ8N0+7Ar1N8tAVzdnzeXzefVxfxUH1 Ih0fiVchivP/OnI5pGbNFVQpVkUCY5GV8DJwb0xogbA8lpenA9srWSKBbcczRECpzR6Y ntfylwu7LbFq42lI4/N1asH8ZCbOPtuaa28NJsGql4SrP2N7mC6aSlGhRnkJhggiiBBL WmYQ== X-Gm-Message-State: AFqh2kqSJXjvOMXhndxX7EwMZGE8xOR1YlOJU6RXnjmw935p4IuKeCtS eUbelWRIKlBSmZcfviGDJSBmUFdUdMPC867E+M1JRQ== X-Google-Smtp-Source: AMrXdXtY1Ct6Q0uN9UxGKowZcibIYrmSO2B+kzXShATRsXat7vZOWdyPlemKxIFu4aVKAno0xiCo82UWNO4TrTf5duI= 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-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: A5D7E140019 X-Stat-Signature: e75p73ba5dmd3yc15ur4msfwdqzndpi4 X-HE-Tag: 1671738312-756945 X-HE-Meta: U2FsdGVkX182rxJpasO9ZXycL8dxuA4grA9wXZHtaRVxjFK8Rbq1o5gGIIn/9lvtIXoMSumisLnKBBldR/3f8MTQnZIBQ+kGMdJrGHe989ZfLnI1zEKPxABbxhP37RWrmvpa+Za2WG64XuM5jvcNSJGLjtoXrUZntUUW/D0bi+4YXfycmLziyMONF2sV2ebCpxsNMzVZzaD1oevyFl6mY+J3wEcafkQXIAueubmzMM8v3wCgkDElVEwkeKVyu0jZq/TwBloaPaGmHe6yb7iEttZ28GP+7cYthInjhrwHhIT45KD0zZGL7ebuxVhA+Yh6XfHUVbly/E1ry9de+/7ei+05Aw5KMFHb2Q4fhua0G5hNWni7GHsgJ6Glxc/RDE2q8drO3rwP4r6jjAy8Vdb55L8B1oJ1+Nj/vt4TS7v5OauL355ePahFqv2bl2x2F+lgZEScsyi+EakEIENcgsRTJlFrf9hrxO9W3J9LNorwii0dqIGVP+lsS2pfcLNsCmfrqA6XHOU2mPBwXVVhkEYcEJ/NpUZ6sWhBSpLBKR2CPAVLGR4kr1PEtHR5QcrQKvDC8GJjtDJF+j4VKziWrh81k7HzTAib0EEXbTZfi7sqhxYvBi9JfgYFmSIUcoTHepLKynsjDVfsLhOwHOoQfk5GwhDsSMyNqysWfJdO8jA2cQpuNDbYokyZRtQL5VewIZ9SXDbxNSzu8EKP9jzWhKlLWebHDtRrOWKEONInNRzCkCIMc6hcADbiI+qWBgloRDVF6RNj+TjncwnYjHxN1pF6Bn1AmJh1y4lAOYXm6/mrTL6nRiqOdjN79A8/xobNSH81taYiOcJSYQlR5VRzRwz/8hCooHDRtOZA8qy9+osBmwBKjalRp92Vg7NmxX9qyHzM/BkBoB2chY+v1HrU2oPi5f4AFsCGOl63gV/pPBltEPWO9jIGJKloPBqHpxj0d1NrrGhT09nWesMB+9LZXAU svmWzwGk CExuHGwivAyTLa9H+teFORfTNkpwgXooL2h1804hjWsHDsiB3Wdw0Vw3bZw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.