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 1A279C433F5 for ; Tue, 4 Jan 2022 21:34:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8CD8C6B0072; Tue, 4 Jan 2022 16:34:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8559B6B0073; Tue, 4 Jan 2022 16:34:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CF276B0074; Tue, 4 Jan 2022 16:34:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0106.hostedemail.com [216.40.44.106]) by kanga.kvack.org (Postfix) with ESMTP id 51E906B0072 for ; Tue, 4 Jan 2022 16:34:48 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id CCB7090087 for ; Tue, 4 Jan 2022 21:34:47 +0000 (UTC) X-FDA: 78993909414.20.D88C385 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) by imf20.hostedemail.com (Postfix) with ESMTP id A332D1C0008 for ; Tue, 4 Jan 2022 21:34:37 +0000 (UTC) Received: by mail-ed1-f49.google.com with SMTP id z29so153596389edl.7 for ; Tue, 04 Jan 2022 13:34:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9sZ4yuZGqCPqkUDnmCAq5OUkSffiqPtJLP/mxilEStc=; b=WTQCJWiv/F+zhihRmn78BQddeC/Aw0oCQZBElMoXRJVG0+X7CNlVU8TYFOV20Oh5WE z0rV8GBZbj47SX8qHPJu6ELaRQdWsC+bROMLvqOZa9L0wZzl3Gw+Gl8cp6ri6RK+G5iT Vk+4igFuBi1wjYknZjhz8qCMITn8347p12Mhk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9sZ4yuZGqCPqkUDnmCAq5OUkSffiqPtJLP/mxilEStc=; b=U+iwylcgdcUvX5cJilv/bKsN7/nXy+7abCuD6Mo/sXlygyKEEl4ac/QqqcpPbear4O O6xf8dPKkIMf7g+sTwHbQs0OZEHIwxkhKhay3nLwxSNAmVqmST5N/INdAyaJk+BU0mCy ZkaVwVlH+u+FEQLE+jPwylr0Vtr6Lj6FwtpsME8EEn1KrVrxv+JMFMFFB0eWNQ3YXNvC dQ/8o/q6ovtGdyvmz+CVt+lyRo/xiGcSadvCIm3GM4ZjvNQJwKQP1O/L6mNT5CJWu1nz dFZr1vs/WL9p23OXu8JqEo7rszC+konSp+qNsIldgMvfHPPFclSG2TuqdUYJmxOlL4lr zRdQ== X-Gm-Message-State: AOAM530DIwfjAlMV7DPUEbs8v1ahcBsH5cysRBsBb301l5eSHZgljNpA lsHa+Bgdc9JTekFB/hRdV083X8sijUPkx79CZnA= X-Google-Smtp-Source: ABdhPJwQR9HbkgFlrrJVEPN7kXHYOYqs3CEr5l9Zp4/Jccj9IpXmBxDQ84GPq/3SDPJwj1whjy1IYw== X-Received: by 2002:a17:907:94ce:: with SMTP id dn14mr39360824ejc.85.1641332085523; Tue, 04 Jan 2022 13:34:45 -0800 (PST) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com. [209.85.128.43]) by smtp.gmail.com with ESMTPSA id b5sm1170510edz.14.2022.01.04.13.34.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Jan 2022 13:34:45 -0800 (PST) Received: by mail-wm1-f43.google.com with SMTP id f134-20020a1c1f8c000000b00345c05bc12dso2162119wmf.3 for ; Tue, 04 Jan 2022 13:34:45 -0800 (PST) X-Received: by 2002:a7b:c305:: with SMTP id k5mr224179wmj.144.1641332074339; Tue, 04 Jan 2022 13:34:34 -0800 (PST) MIME-Version: 1.0 References: <20220104202227.2903605-1-yuzhao@google.com> <20220104202227.2903605-5-yuzhao@google.com> In-Reply-To: <20220104202227.2903605-5-yuzhao@google.com> From: Linus Torvalds Date: Tue, 4 Jan 2022 13:34:18 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v6 4/9] mm: multigenerational lru: groundwork To: Yu Zhao Cc: Andrew Morton , Andi Kleen , Catalin Marinas , Dave Hansen , Hillf Danton , Jens Axboe , Jesse Barnes , Johannes Weiner , Jonathan Corbet , Matthew Wilcox , Mel Gorman , Michael Larabel , Michal Hocko , Rik van Riel , Vlastimil Babka , Will Deacon , Ying Huang , Linux ARM , "open list:DOCUMENTATION" , Linux Kernel Mailing List , Linux-MM , page-reclaim@google.com, "the arch/x86 maintainers" , Konstantin Kharlamov Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: A332D1C0008 X-Stat-Signature: p9763dofzebyrnd8nk7m5xkpmzrnu17e Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=WTQCJWiv; spf=pass (imf20.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.208.49 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none X-Rspamd-Server: rspam10 X-HE-Tag: 1641332077-157266 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 Tue, Jan 4, 2022 at 12:23 PM Yu Zhao wrote: > > index a7e4a9e7d807..fadbf8e6abcd 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > > +#ifdef CONFIG_LRU_GEN > +static inline void task_enter_lru_fault(void) > +{ > + WARN_ON_ONCE(current->in_lru_fault); ... Why are these in this very core header file? They are used in one single file - mm/memory.c. They should be just static functions there. I'm also not sure why the calling convention is if (lru_fault) task_enter_lru_fault(); instead of doing just task_enter_lru_fault(vma); and having that function do /* Don't do LRU fault accounting for SEQ/RAND files */ if (unlikely(vma->vm_flags & (VM_SEQ_READ | VM_RAND_READ))) return; which would seem to be a lot more legible and straightforward. In fact, you could do it without any conditionals at all, if you just remove the WARN_ON_ONCE() from the exit path, turning it into just current->in_lru_fault = !(vma->vm_flags & (VM_SEQ_READ | VM_RAND_READ)); for 'enter' and just current->in_lru_fault = 0; for exit. It seems pointless to have that extra variable, and the extra conditionals, for a case that is probably very unusual indeed. Linus