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=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 4C142C4363D for ; Fri, 25 Sep 2020 15:44:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B17EB21741 for ; Fri, 25 Sep 2020 15:44:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cctgAw8o" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B17EB21741 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2A5E1900004; Fri, 25 Sep 2020 11:44:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 22EC46B009A; Fri, 25 Sep 2020 11:44:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0F5F8900004; Fri, 25 Sep 2020 11:44:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0058.hostedemail.com [216.40.44.58]) by kanga.kvack.org (Postfix) with ESMTP id EA41F6B0099 for ; Fri, 25 Sep 2020 11:44:17 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B3DBF180AD804 for ; Fri, 25 Sep 2020 15:44:17 +0000 (UTC) X-FDA: 77302005354.11.rail54_1315b8527168 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 8C610180F8B80 for ; Fri, 25 Sep 2020 15:44:17 +0000 (UTC) X-HE-Tag: rail54_1315b8527168 X-Filterd-Recvd-Size: 4156 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Fri, 25 Sep 2020 15:44:17 +0000 (UTC) Received: by mail-ej1-f43.google.com with SMTP id q13so4229314ejo.9 for ; Fri, 25 Sep 2020 08:44:17 -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=HEz+vQY3sJSfqPESFXrr4RQDmKlTs9/OcbemQWi6fx0=; b=cctgAw8ogGx6vkbkK16JhKJ6bICSnYRLX14s0bq1fpXFVsoaeZcynGtC92QEV3TptP lLUAQyIltnBA8bpmlmLKfhtxRqdXcQDRsylSDYwFeBNgFRn0OEibv8ljzO50gB1/3+Xz V8+qnKa5eMHi328uY/POuojiFeUQnDcmK0gJgGCyS6aEQAMvQD9KjRbKMC03kJcxfWdv 3tujC83WcorTOuun2DpWlFqGCluXoaI6sIvDDLGcoDRaMY3CwsXS9ULU7ugVOWuhhUzK tUMNl1VKlb1o33JoQX2FgoyJ6d8WqBAbwRm2ITDNEYr4NHhsOPHa4Y3DiratnROSpp1P EFXg== 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=HEz+vQY3sJSfqPESFXrr4RQDmKlTs9/OcbemQWi6fx0=; b=PskwfPG8WRcbe7IkMN8OrEo0CSB8gk2w1BgP4cAn5zwOhz7eCNry9oDaj+IK40ONrq DfJp5VY8SxZ86fCvzn5nlgFiWxKskmGWJ6ZhOJFvhq25rMYnt20PlEHYs8NwJkM8HoV/ TEFHSMSlBivQhlEFtgz3VempTyWtoOpLCjur59pIdHQoYVf5RbWdpd3SU8Qmj//YkMm+ bfmlnS8SuAAteIWwtVMroG4VBjQ8UY+NKILcTUxv13z7vGLK0N+wPzB1MsEA3BRj8VRx O0qq3oB2ZLquHyyDaSooCu5E643ufcvp25pnG2OQM8d6E43oy0IxaYIY3btuIkYLIMzQ EkEg== X-Gm-Message-State: AOAM530nUrXc+StI7JfZ9AL14GxXPaD5cnq7Ff29PG0+/oJF2DH6ujT6 ucIk21HG0uIQ9/7jjddLcYimTBE5013TdoiLf8U= X-Google-Smtp-Source: ABdhPJy1j2znOW5F4ThuEamBOg/jxT43C7n8X9OWzcPVypIGn3AGrSZthQ6x1eQmj0/QO2M0DTUJUhniFHsjwjHqiuU= X-Received: by 2002:a17:906:7e0e:: with SMTP id e14mr3264123ejr.238.1601048655979; Fri, 25 Sep 2020 08:44:15 -0700 (PDT) MIME-Version: 1.0 References: <20200925150050.GF32101@casper.infradead.org> In-Reply-To: From: Yang Shi Date: Fri, 25 Sep 2020 08:44:04 -0700 Message-ID: Subject: Re: PageLRU and the other flags To: David Hildenbrand Cc: Matthew Wilcox , Linux MM Content-Type: text/plain; charset="UTF-8" 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 Fri, Sep 25, 2020 at 8:21 AM David Hildenbrand wrote: > > On 25.09.20 17:00, Matthew Wilcox wrote: > > I'm not quite familiar with this side of the MM yet, but it seems to > > me like we're encoding four page states in three bits: > > > > - !PageLRU (not an LRU page) > > - PageLRU (on the inactive list) > > - PageLRU + PageActive (on the active list) > > - PageLRU + PageUnevictable (on the unevictable list) > > > > Can we neaten this up into two bits? > > > > - 00 (not an LRU page) > > - 01 (active list) > > - 10 (inactive list) > > - 11 (unevictable) > > > > People who free up page flags are always popular, right? > > They are the best :) > > Looking at __pagevec_lru_add_fn() > > SetPageLRU(page); > smp_mb__after_atomic(); > ... > > if (page_evictable(page)) { > ... > } else { > lru = LRU_UNEVICTABLE; > ClearPageActive(page); > SetPageUnevictable(page); > ... > } > > Looks like PageActive(page) could have been relevant even without > SetPageLRU(page); > > So the combo > > !PageLRU() + PageActive (previously was on the active list maybe?) > > might be valid? Or dead code? Or valid races (someone else spotting > PageLRU() and setting it PageActive(page))? Yes, it is valid. The page might be marked active when it is on pagevec, then will be moved to active LRU in the next drain. Please refer to the comment in mark_page_accessed(). > But no expert, just blindly poking around ... > > -- > Thanks, > > David / dhildenb > >