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 C1165C433F5 for ; Wed, 12 Jan 2022 08:05:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BF1EA6B0124; Wed, 12 Jan 2022 03:05:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BA2836B0125; Wed, 12 Jan 2022 03:05:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A697B6B0126; Wed, 12 Jan 2022 03:05:58 -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 949F96B0124 for ; Wed, 12 Jan 2022 03:05:58 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 34BFA94FA1 for ; Wed, 12 Jan 2022 08:05:58 +0000 (UTC) X-FDA: 79020901596.18.D4D3D40 Received: from mail-io1-f48.google.com (mail-io1-f48.google.com [209.85.166.48]) by imf27.hostedemail.com (Postfix) with ESMTP id BC89A40007 for ; Wed, 12 Jan 2022 08:05:57 +0000 (UTC) Received: by mail-io1-f48.google.com with SMTP id v1so2446847ioj.10 for ; Wed, 12 Jan 2022 00:05:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=pyw7GGJuc0hBOwmctWzhV5NE4YVpQMRChj4A/vKkkr4=; b=Z+qDYRtw4H7+Xhjv9rXrIpQm265j7kHSqnL11bYAwhEcsXLlyCTMo4DGQMSeyO22BX IjKFWkNtLTgesG7Dn90valcqe2XUfiJ5fv7aqbCbm0gtpV2aRAJ/6H/f6hZL/ZpJXmh9 6cbze64uaBbCwy+JMGzKYboFBVl+cMocBG9e5v+YJmevCYJ0bH0chy6VC9DXMG/IAWO8 bwJQ8FzyaP+8SF9sUohyCD0DwZkzr1qLhTz8HHaHRF9v1ge8ypjGonWRsQH18MvTwvnc YR1tfC6ouTRJowyCKbTSk44cHOVHtB/1i7achYXAt7eVF4T5cfzcr61g8W0DZC6jFbjr H3ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=pyw7GGJuc0hBOwmctWzhV5NE4YVpQMRChj4A/vKkkr4=; b=aAnh9rw0Weq92bd1rHqgLpqcY2IlO2DTyFdVv+hE1aE8DBiYdkAaNSpa2FrXUH3yh7 vnCXK6hQK49B0z9nJFmUZlI4gIpYdEfpZpo09RjFzdjbmEXYeVpO1Ep74PI5eH7mhAvv gJ9SK7k5YRkmlVwZtgz4SsvZh0aGrcJKHQFaADSYaNCX2tS2HUcscVMpUav66B41rYwg QV4Ez389Phjv4o4w6oUFkxPNEyuzCQV8haKSSmRR42CFmx90QRYLWcWJCmx94ZzhqirQ pZKKE4SRP2SgTBL33GUyu+2uTQ3LESrN96BkWjH0ibtRWdFaLNgNelsmnNfy3ICCoqAO 1Ucw== X-Gm-Message-State: AOAM533rydP32N37JzW+rYoFOWukdJDY2j8hNB1ynWFzkYcWBC/2GRYL ntf5RYI6iUxbplX/Yvsm3MuAwQ== X-Google-Smtp-Source: ABdhPJxS1FZp/i/SPqHdj4pGDjPeqMB4/I876fPMsGFsuuH99sxVcJWSlXkHHhif8uuR0sVcS/X06A== X-Received: by 2002:a05:6638:d01:: with SMTP id q1mr4064289jaj.248.1641974756815; Wed, 12 Jan 2022 00:05:56 -0800 (PST) Received: from google.com ([2620:15c:183:200:b6b6:70f4:b540:6383]) by smtp.gmail.com with ESMTPSA id c3sm1856408iow.28.2022.01.12.00.05.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 00:05:56 -0800 (PST) Date: Wed, 12 Jan 2022 01:05:51 -0700 From: Yu Zhao To: "Aneesh Kumar K.V" Cc: Andrew Morton , Linus Torvalds , 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-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, page-reclaim@google.com, x86@kernel.org, Konstantin Kharlamov Subject: Re: [PATCH v6 7/9] mm: multigenerational lru: eviction Message-ID: References: <20220104202227.2903605-1-yuzhao@google.com> <20220104202227.2903605-8-yuzhao@google.com> <87czkyzhfe.fsf@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87czkyzhfe.fsf@linux.ibm.com> Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Z+qDYRtw; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf27.hostedemail.com: domain of yuzhao@google.com designates 209.85.166.48 as permitted sender) smtp.mailfrom=yuzhao@google.com X-Stat-Signature: frsuwb6nqd3sfnkkprk1zjy78jssj466 X-Rspamd-Queue-Id: BC89A40007 X-Rspamd-Server: rspam12 X-HE-Tag: 1641974757-715650 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 11, 2022 at 04:07:57PM +0530, Aneesh Kumar K.V wrote: > ... > > +static int isolate_folios(struct lruvec *lruvec, struct scan_control *sc, int swappiness, > > + int *type_scanned, struct list_head *list) > > +{ > > + int i; > > + int type; > > + int scanned; > > + int tier = -1; > > + DEFINE_MIN_SEQ(lruvec); > > + > > + VM_BUG_ON(!seq_is_valid(lruvec)); > > + > > + /* > > + * Try to make the obvious choice first. When anon and file are both > > + * available from the same generation, interpret swappiness 1 as file > > + * first and 200 as anon first. > > + */ > > + if (!swappiness) > > + type = 1; > > + else if (min_seq[0] < min_seq[1]) > > + type = 0; > > + else if (swappiness == 1) > > + type = 1; > > + else if (swappiness == 200) > > + type = 0; > > + else > > + type = get_type_to_scan(lruvec, swappiness, &tier); > > + > > Wondering wether it will make it simpler to use > #define ANON 0 > #define FILE 1 > > and then > else if (min_seq[ANON] < min_seq[FILE]) > type = ANON; > > The usage of 0/1 across code do confuse I agree, and I plan to do this later because the existing code uses this convention and needs renaming too.