Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp820067imd; Thu, 1 Nov 2018 06:10:57 -0700 (PDT) X-Google-Smtp-Source: AJdET5dTgr8eFULSKSwky2Op9OgmiITx7fZuC5DuBN7YbSMdsEj5gYeF1B7UxqOxpO6ZYU+4zRW5 X-Received: by 2002:a62:8647:: with SMTP id x68-v6mr8037105pfd.252.1541077857145; Thu, 01 Nov 2018 06:10:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541077857; cv=none; d=google.com; s=arc-20160816; b=L3SILCT5kUCI5sZ6kcG18nwOMUSGEBIyaQvaDdxW/2SxAYXwdeW9nBP46RgUZeE8Io J+u4mnP+sX2/5xp1YxjNIUUM132azCbp/Nyb0SWUFC3CMhLvkG/58oE20jR4PZOW/O0o tj6wMcvJ/P39cC6kAGGLiv8ax+wJYditLccGJTTVcIVzGUyIAYPEWg4UQaP3U+Ac4pBG euzHmy6vUV+fjgIN3c2fngB0h34weyhsa+5zowwxSbpBKWsbs75e8zLdsTCkig/oXeq+ SXXqavRYJ1BEaMVpxg8WpT1Ch6vftRUXV3GkhpN6LgMlErPu6aKFadirVxz2jan6xlkf OgVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=NTqUn/ic1fChfoymXbjFnMc4XwH6dCWSszVRt3/vibo=; b=pwof3UDSDUzcBYKCSMhQo62dyDOKKdHbBZQJ93WC/PLOlPb78Vr7+8XsONW/YD9x/B NRwgKtBxruVFH6ojW3OwDkex8QDiyJwCaAt9qpyxvTlvN53TYqekrbar1xnIB7KeOPrY uFDSHb2g9kUYxHJFFR+Oh6Dzp9ySSX67/ofowKPZ9M5VOYON6j9rhfSzQso4XMNVTYpN qL8YvfDY67Txv9efGkxDv5BhmBAUzV/XTr00hGmjRthFqoyuHl04uZxfYcy5srlCR0Hr rhFhqeDSsiHimAID3njU21hl3q0py5lQ3p5PH2OoC3AgQvC3XaaaNRY5qgJoD8mYr9hV 09Iw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6-v6si29140406plq.275.2018.11.01.06.10.37; Thu, 01 Nov 2018 06:10:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728450AbeKAWNH (ORCPT + 99 others); Thu, 1 Nov 2018 18:13:07 -0400 Received: from mx2.suse.de ([195.135.220.15]:55066 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727644AbeKAWNH (ORCPT ); Thu, 1 Nov 2018 18:13:07 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id CB16BADD6; Thu, 1 Nov 2018 13:10:11 +0000 (UTC) Date: Thu, 1 Nov 2018 14:09:10 +0100 From: Michal Hocko To: Vovo Yang Cc: dave.hansen@intel.com, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-mm@kvack.org, Chris Wilson , Joonas Lahtinen , peterz@infradead.org, akpm@linux-foundation.org Subject: Re: [PATCH v3] mm, drm/i915: mark pinned shmemfs pages as unevictable Message-ID: <20181101130910.GI23921@dhcp22.suse.cz> References: <20181031081945.207709-1-vovoy@chromium.org> <20181031142458.GP32673@dhcp22.suse.cz> <20181031164231.GQ32673@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 01-11-18 19:28:46, Vovo Yang wrote: > On Thu, Nov 1, 2018 at 12:42 AM Michal Hocko wrote: > > On Wed 31-10-18 07:40:14, Dave Hansen wrote: > > > Didn't we create the unevictable lists in the first place because > > > scanning alone was observed to be so expensive in some scenarios? > > > > Yes, that is the case. I might just misunderstood the code I thought > > those pages were already on the LRU when unevictable flag was set and > > we would only move these pages to the unevictable list lazy during the > > reclaim. If the flag is set at the time when the page is added to the > > LRU then it should get to the proper LRU list right away. But then I do > > not understand the test results from previous run at all. > > "gem_syslatency -t 120 -b -m" allocates a lot of anon pages, it consists of > these looping threads: > * ncpu threads to alloc i915 shmem buffers, these buffers are freed by i915 > shrinker. > * ncpu threads to mmap, write, munmap an 2 MiB mapping. > * 1 thread to cat all files to /dev/null > > Without the unevictable patch, after rebooting and running > "gem_syslatency -t 120 -b -m", I got these custom vmstat: > pgsteal_kswapd_anon 29261 > pgsteal_kswapd_file 1153696 > pgsteal_direct_anon 255 > pgsteal_direct_file 13050 > pgscan_kswapd_anon 14524536 > pgscan_kswapd_file 1488683 > pgscan_direct_anon 1702448 > pgscan_direct_file 25849 > > And meminfo shows large anon lru size during test. > # cat /proc/meminfo | grep -i "active(" > Active(anon): 377760 kB > Inactive(anon): 3195392 kB > Active(file): 19216 kB > Inactive(file): 16044 kB > > With this patch, the custom vmstat after test: > pgsteal_kswapd_anon 74962 > pgsteal_kswapd_file 903588 > pgsteal_direct_anon 4434 > pgsteal_direct_file 14969 > pgscan_kswapd_anon 2814791 > pgscan_kswapd_file 1113676 > pgscan_direct_anon 526766 > pgscan_direct_file 32432 > > The anon pgscan count is reduced. OK, so that explain my question about the test case. Even though you generate a lot of page cache, the amount is still too small to trigger pagecache mostly reclaim and anon LRUs are scanned as well. Now to the difference with the previous version which simply set the UNEVICTABLE flag on mapping. Am I right assuming that pages are already at LRU at the time? Is there any reason the mapping cannot have the flag set before they are added to the LRU? -- Michal Hocko SUSE Labs