Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp764585imd; Thu, 1 Nov 2018 05:21:50 -0700 (PDT) X-Google-Smtp-Source: AJdET5eh9NGG2h04nrbZopPJRuqHPUv77CV0csbJqFPYvmsO3+2jHGAY7mmkntQSNY1rE0xS0Xv9 X-Received: by 2002:a63:e70a:: with SMTP id b10-v6mr6774695pgi.363.1541074909979; Thu, 01 Nov 2018 05:21:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541074909; cv=none; d=google.com; s=arc-20160816; b=DtdPrIpokwQIZjz+lj5365gnYSeI+sTeGWjrqtwsWNWMngGlFvZF/wPqo0Wmge+KUL 5vxYYTjimLggPul4KPO+KO1B3AXqDxTbrAg0ltsVqDRm2WLEmLpOPpXKSS5oftLa0fbM bStNrQeOJcq908n0PlwM4Kmq4N/Qrdc3rT9uMqeEnK8zGAJHhDXCdOGRDdCaT+dG+AFT FFfZ2vJ6h98QIiDlX+h9cjCnRp2yGK9NxluIr7cd5y+vHxUEneDGdfFA7JG6kyLN5Fsz ItiiBTemRAC7V+YnvKjQ6IIYoFbQwOXtpcy+gxx/dLIN9/3JWETHhsRyjzO6ZhA+D1cP XxoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:user-agent:message-id :references:cc:in-reply-to:from:to:content-transfer-encoding :mime-version; bh=PPYvJeYC75aDIE7ulW6pIvTc0umfJEG9NqPX5jPbPWM=; b=toJD+1lm2VJdPysoiY7Td3qROWh4j9sxstyJ5mekEnz3FV4Ba5kHls5Mo+SqGcpb7u jJixIVMIhHtfq0pm9I4OTA2siNmRH+N8lNJ9jdKh9ZAIspUc+/O0Kxu6suXWI7lxYcj1 WBkrkInuS7U4U4bQG9LTjvZp7djlbikzdct3iLb+dqJ2DMhAyhAk04rwJGRsGQXatH9L qZ7G9wIl2ytSdQ2NascoFwbRhuWkubKJcuf7J3vigSmFhmG3VNToNUwXEKn09k6doE1o 0ceJC+8lg6pgpG55BKUs/zWB3rTt978g3hif8bb7goX95AINK2U4Zjmj41Ic1Nxg1kTn L5eA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l8-v6si6475016pgi.263.2018.11.01.05.21.31; Thu, 01 Nov 2018 05:21:49 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728506AbeKAVXn convert rfc822-to-8bit (ORCPT + 99 others); Thu, 1 Nov 2018 17:23:43 -0400 Received: from mail.fireflyinternet.com ([109.228.58.192]:60599 "EHLO fireflyinternet.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728414AbeKAVXn (ORCPT ); Thu, 1 Nov 2018 17:23:43 -0400 X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from localhost (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP (TLS) id 14313774-1500050 for multiple; Thu, 01 Nov 2018 12:20:16 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT To: Kuo-Hsin Yang , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org From: Chris Wilson In-Reply-To: <154097891543.4007.9898414288875202246@skylake-alporthouse-com> Cc: Kuo-Hsin Yang , Michal Hocko , Joonas Lahtinen , Peter Zijlstra , Andrew Morton , Dave Hansen References: <20181031081945.207709-1-vovoy@chromium.org> <154097891543.4007.9898414288875202246@skylake-alporthouse-com> Message-ID: <154107481370.4007.2421593962367820741@skylake-alporthouse-com> User-Agent: alot/0.6 Subject: Re: [PATCH v3] mm, drm/i915: mark pinned shmemfs pages as unevictable Date: Thu, 01 Nov 2018 12:20:13 +0000 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Chris Wilson (2018-10-31 09:41:55) > Quoting Kuo-Hsin Yang (2018-10-31 08:19:45) > > The i915 driver uses shmemfs to allocate backing storage for gem > > objects. These shmemfs pages can be pinned (increased ref count) by > > shmem_read_mapping_page_gfp(). When a lot of pages are pinned, vmscan > > wastes a lot of time scanning these pinned pages. In some extreme case, > > all pages in the inactive anon lru are pinned, and only the inactive > > anon lru is scanned due to inactive_ratio, the system cannot swap and > > invokes the oom-killer. Mark these pinned pages as unevictable to speed > > up vmscan. > > > > Add check_move_lru_page() to move page to appropriate lru list. > > > > This patch was inspired by Chris Wilson's change [1]. > > > > [1]: https://patchwork.kernel.org/patch/9768741/ > > > > Cc: Chris Wilson > > Cc: Michal Hocko > > Cc: Joonas Lahtinen > > Cc: Peter Zijlstra > > Cc: Andrew Morton > > Cc: Dave Hansen > > Signed-off-by: Kuo-Hsin Yang > > --- > > The previous mapping_set_unevictable patch is worse on gem_syslatency > > because it defers to vmscan to move these pages to the unevictable list > > and the test measures latency to allocate 2MiB pages. This performance > > impact can be solved by explicit moving pages to the unevictable list in > > the i915 function. > > > > Chris, can you help to run the "igt/benchmarks/gem_syslatency -t 120 -b -m" > > test with this patch on your testing machine? I tried to run the test on > > a Celeron N4000, 4GB Ram machine. The mean value with this patch is > > similar to that with the mlock patch. > > Will do. As you are confident, I'll try a few different machines. :) I had one anomalous result with Ivybridge, but 3/4 different machines confirm this is effective. I normalized the latency results from each such that 0 is the baseline median latency (no i915 activity) and 1 is the median latency with i915 running drm-tip. N Min Max Median Avg Stddev ivb 120 0.701641 2.79209 1.24469 1.3333911 0.40871825 byt 120 -0.108194 0.0777012 0.0485302 0.01343581 0.061524734 bxt 120 -0.262057 6.27002 0.0801667 0.15963388 0.63528121 kbl 120 -0.0891262 1.22326 -0.0245336 0.041492506 0.14929689 Just need to go back and check on ivb, perhaps running on a few older chipsets as well. But the evidence so far indicates that this eliminates the impact of i915 activity on the performance of shrink_page_list, reducing the amount of crippling stalls under mempressure and often preventing them. -Chris