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 0705FC433EF for ; Sat, 12 Feb 2022 21:01:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2A6EF6B0073; Sat, 12 Feb 2022 16:01:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1448D6B0078; Sat, 12 Feb 2022 16:01:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E886C6B007B; Sat, 12 Feb 2022 16:01:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0052.hostedemail.com [216.40.44.52]) by kanga.kvack.org (Postfix) with ESMTP id DBBB96B0073 for ; Sat, 12 Feb 2022 16:01:29 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 9C9C993681 for ; Sat, 12 Feb 2022 21:01:29 +0000 (UTC) X-FDA: 79135348698.11.5A704D9 Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) by imf29.hostedemail.com (Postfix) with ESMTP id 2617312000B for ; Sat, 12 Feb 2022 21:01:28 +0000 (UTC) Received: by mail-io1-f43.google.com with SMTP id q204so15581000iod.8 for ; Sat, 12 Feb 2022 13:01:28 -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=pMbNysZicDjla5m+LqKnIivTQyASvMT8jxUwCbQWv1g=; b=riVGorTeXgSv6f6PSqT26L43SORlysK2m4uRC/QszDsHk26fohbl3AcXeAU1z5WReD NiLXebj+jUjwxHFaizCF5lM+/IPGT9AeDHCQP7Ki4Nq39KGTQ668UcwNvKBImkPaoHXk KmbjeDZw7fppxgwkgRuh9xN/64WYlgfkC6a5u1qi/mrP2cuMCkW/R7DJwRORH6OWAt7P ethnE+skfclWxvZ36JWfsq6I+25qukq2eaM6QuAD0d/SybO6tkaG8PsRMLAk7yUPMg6G WyCg8Q53Rqg73T6F0bVKystdOEWJIJIs3XjVCZVbtZJJIgeFp3D7X2O9KlWWJvlNgBvj KumA== 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=pMbNysZicDjla5m+LqKnIivTQyASvMT8jxUwCbQWv1g=; b=mzhuhSkCizb9Tw9i+doGPh8Jsubs76T/ugDi2XhAkT9kLXOP7fGrmoPL4v1r2VP41F I8xwsmRXYtizAzkVTwihFqh/w4FjxKU97omIGxF1odIoYRJLFxr5jlcteUuWc5M1iL3t tvoGI7YVUnFu9tfQDqrQDW65fiqV5Au353yvdCY/XHzDUkMKSFdVImpnohwgpeR5tIyV cjynpG7bquJ1bCgKsP4F1JDkY6a59Nrn8QO1VUNphAUE7w5B+WrC9lvkcatnx5Z5wP/M sYOCgC5Xc4EFMp0GgchpkdyTMkqaRcpj/aHFDsFWGK9MfbvRoRn2ybuTYhrRPNANgDWf reTA== X-Gm-Message-State: AOAM533T5ydCFDkM8GZGIuhftLISTEh/PRtVcBorvDB8Nm5juZ4ajcj+ u68c+lznshPckAfbHD7+y6nAgw== X-Google-Smtp-Source: ABdhPJzPD41+d7IoHgG5Q9TFesNC7mfL4rvQpeFd/BtV8ZyYVWurBH52if7QSOBzPeihv02iT4Y7qQ== X-Received: by 2002:a05:6638:22c6:: with SMTP id j6mr3979977jat.216.1644699688189; Sat, 12 Feb 2022 13:01:28 -0800 (PST) Received: from google.com ([2620:15c:183:200:7f5c:29f4:d1c2:e1f6]) by smtp.gmail.com with ESMTPSA id v8sm1703481iox.53.2022.02.12.13.01.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Feb 2022 13:01:27 -0800 (PST) Date: Sat, 12 Feb 2022 14:01:23 -0700 From: Yu Zhao To: Alexey Avramov Cc: 21cnbao@gmail.com, Michael@michaellarabel.com, ak@linux.intel.com, akpm@linux-foundation.org, aneesh.kumar@linux.ibm.com, axboe@kernel.dk, catalin.marinas@arm.com, corbet@lwn.net, dave.hansen@linux.intel.com, hannes@cmpxchg.org, hdanton@sina.com, jsbarnes@google.com, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, mgorman@suse.de, mhocko@kernel.org, page-reclaim@google.com, riel@surriel.com, rppt@kernel.org, torvalds@linux-foundation.org, vbabka@suse.cz, will@kernel.org, willy@infradead.org, x86@kernel.org, ying.huang@intel.com Subject: Re: [PATCH v7 00/12] Multigenerational LRU Framework Message-ID: References: <20220208081902.3550911-1-yuzhao@google.com> <20220212051219.183d1baf@PC> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220212051219.183d1baf@PC> X-Rspamd-Queue-Id: 2617312000B X-Rspam-User: Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=riVGorTe; spf=pass (imf29.hostedemail.com: domain of yuzhao@google.com designates 209.85.166.43 as permitted sender) smtp.mailfrom=yuzhao@google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: 3n15fu8f53ocebaaguh57okzunor9ehj X-Rspamd-Server: rspam11 X-HE-Tag: 1644699688-754416 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 Sat, Feb 12, 2022 at 05:12:19AM +0900, Alexey Avramov wrote: > Aggressive swapping even with vm.swappiness=1 with MGLRU > ======================================================== > > Reading a large mmapped file leads to a super agressive swapping. > Reducing vm.swappiness even to 1 does not have effect. Mind explaining why you think it's "super agressive"? I assume you expected a different behavior that would perform better. If so, please spell it out. > Demo: https://www.youtube.com/watch?v=J81kwJeuW58 > > Linux 5.17-rc3, Multigenerational LRU v7, > vm.swappiness=1, MemTotal: 11.5 GiB. > > $ cache-bench -r 35000 -m1 -b1 -p1 -f test20000 > Reading mmapped file (file size: 20000 MiB) > cache-bench v0.2.0: https://github.com/hakavlad/cache-bench Writing your own benchmark is a good exercise but fio is the standard benchmark in this case. Please use it with --ioengine=mmap. > Swapping started with MemAvailable=71%. > At the end 33 GiB was swapped out when MemAvailable=60%. > > Is it OK? MemAvailable is an estimate (free + page cache), and it doesn't imply any reclaim preferences. In the worst case scenario, e.g., out of swap space, MemAvailable *may* be reclaimed. Here is my benchmark result with file mmap + *high* swap usage. Ram disk was used to reduce the variance in the result (and SSD wear out if you care). More details on additional configurations here: https://lore.kernel.org/linux-mm/20220208081902.3550911-6-yuzhao@google.com/ Mixed workloads: fio (buffered I/O): +13% IOPS BW 5.17-rc3: 275k 1075MiB/s v7: 313k 1222MiB/s memcached (anon): +12% Ops/sec KB/sec 5.17-rc3: 511282.72 19861.04 v7: 572408.80 22235.49 cat mmap.sh systemctl restart memcached swapoff -a umount /mnt rmmod brd modprobe brd rd_nr=2 rd_size=56623104 mkswap /dev/ram0 swapon /dev/ram0 mkfs.ext4 /dev/ram1 mount -t ext4 /dev/ram1 /mnt memtier_benchmark -S /var/run/memcached/memcached.sock \ -P memcache_binary -n allkeys --key-minimum=1 \ --key-maximum=50000000 --key-pattern=P:P -c 1 \ -t 36 --ratio 1:0 --pipeline 8 -d 2000 sysctl vm.overcommit_memory=1 fio -name=mglru --numjobs=36 --directory=/mnt --size=1408m \ --buffered=1 --ioengine=mmap --iodepth=128 --iodepth_batch_submit=32 \ --iodepth_batch_complete=32 --rw=randread --random_distribution=random \ --norandommap --time_based --ramp_time=10m --runtime=990m \ --group_reporting & pid=$! sleep 200 memcached.sock -P memcache_binary -n allkeys --key-minimum=1 \ --key-maximum=50000000 --key-pattern=R:R -c 1 -t 36 --ratio 0:1 \ --pipeline 8 --randomize --distinct-client-seed kill -INT $pid wait