Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp534921imu; Mon, 5 Nov 2018 05:04:30 -0800 (PST) X-Google-Smtp-Source: AJdET5d/ktAp99ru9OnVLTggwfPzE7wDXMfauilKs3gdQU8wedoa3VDwutJm+0qOsPb10gOYCTFC X-Received: by 2002:a63:2586:: with SMTP id l128mr20484837pgl.104.1541423070858; Mon, 05 Nov 2018 05:04:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541423070; cv=none; d=google.com; s=arc-20160816; b=GWaO6nR5ZpH5UCwbhKE5nJ9HRHlj8OSBwqHEE+8vWg1vLbFHTI8RVUuAAxvWfp2ODx lD3yUaaB9WYOTE589c+GrHL1O8X1Uuhvnal8mYrIK3SUL8pohmFm7w4mALtLXGEmCTCH pQhFBAOIp3lg4BaKpaUubD365cwIyi1CmcT0HuHLI0n7fk7kpYAjDxxmhg/278R2jR1L l7bZAjGS7vhqk00W7vyyalBz58FF4eErc0faTpds1yRfU/eNQnJ1+lRJjecPLxv4qMeK fWT0TwgTCNJztGQT0ZEPDJK9bbJXUUQHuE/dfYzZsmHSs6DnmjeQlRbKmnd8OZtQ379+ DFuA== 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=rnLbSOtKMLWdzeK161cXfUU8UE7RJ+oSIEHbEbJjqhM=; b=VfLRLCsQnL0enNEY7i9BI33czC98QeK7dEalX2jBGLMWYnrEwfwsJlia4NoiYBW2N0 Jt/E8Is10VMe3Eo1SQeFYPi+HghmNdAuGmMNXFoMHWu1ffSxj4Xt4ek3h9QyH85/Lm4f KuxAb1vDwtOk06t1h1S/3EL3Jr0SmmXLG2a2tk2tgjlQrKzt+ZKkiMnb670bvcQPcfx7 k7bDxCKO2mnx3yVnHWG4hteRoqSaxY5xHEtXTUh7RZB+m1hLfU0SRQREkeoLplCesa+i DPy2C1heZPsJfhHQCiB2Zfu4Dnk/hpQIZdkOZ09K6Z0kCm3iU9e2cb7qlXamm8YmTGNq jk0Q== 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 y126-v6si9994532pfy.22.2018.11.05.05.04.07; Mon, 05 Nov 2018 05:04:30 -0800 (PST) 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 S1729804AbeKEWVw (ORCPT + 99 others); Mon, 5 Nov 2018 17:21:52 -0500 Received: from mx2.suse.de ([195.135.220.15]:42528 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728136AbeKEWVv (ORCPT ); Mon, 5 Nov 2018 17:21:51 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8CC77AFE2; Mon, 5 Nov 2018 13:02:10 +0000 (UTC) Date: Mon, 5 Nov 2018 14:02:09 +0100 From: Michal Hocko To: Kuo-Hsin Yang Cc: linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-mm@kvack.org, Chris Wilson , Joonas Lahtinen , Peter Zijlstra , Andrew Morton , Dave Hansen Subject: Re: [PATCH v4] mm, drm/i915: mark pinned shmemfs pages as unevictable Message-ID: <20181105130209.GI4361@dhcp22.suse.cz> References: <20181105111348.182492-1-vovoy@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181105111348.182492-1-vovoy@chromium.org> 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 Mon 05-11-18 19:13:48, Kuo-Hsin Yang wrote: > 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. > > Export pagevec API check_move_unevictable_pages(). Thanks for reworking the patch. This looks much more to my taste. At least the mm part. I haven't really looked at the the drm part. Just a nit below > This patch was inspired by Chris Wilson's change [1]. > > [1]: https://patchwork.kernel.org/patch/9768741/ I would recommend using msg-id based url. > Cc: Chris Wilson > Cc: Michal Hocko > Cc: Joonas Lahtinen > Cc: Peter Zijlstra > Cc: Andrew Morton > Cc: Dave Hansen > Signed-off-by: Kuo-Hsin Yang other than that Acked-by: Michal Hocko [...] > @@ -4184,15 +4185,13 @@ int page_evictable(struct page *page) > > #ifdef CONFIG_SHMEM > /** > - * check_move_unevictable_pages - check pages for evictability and move to appropriate zone lru list > - * @pages: array of pages to check > - * @nr_pages: number of pages to check > + * check_move_unevictable_pages - move evictable pages to appropriate evictable > + * lru lists I am not sure this is an improvement. I would just keep the original wording. It is not great either but the explicit note about check for evictability sounds like a better fit to me. > + * @pvec: pagevec with pages to check > * > - * Checks pages for evictability and moves them to the appropriate lru list. > - * > - * This function is only used for SysV IPC SHM_UNLOCK. > + * This function is only used to move shmem pages. I do not really see anything that would be shmem specific here. We can use this function for any LRU pages unless I am missing something obscure. I would just drop the last sentence. A note that this function should be only used for LRU pages would be nice. > */ > -void check_move_unevictable_pages(struct page **pages, int nr_pages) > +void check_move_unevictable_pages(struct pagevec *pvec) > { > struct lruvec *lruvec; > struct pglist_data *pgdat = NULL; > @@ -4200,8 +4199,8 @@ void check_move_unevictable_pages(struct page **pages, int nr_pages) > int pgrescued = 0; > int i; > > - for (i = 0; i < nr_pages; i++) { > - struct page *page = pages[i]; > + for (i = 0; i < pvec->nr; i++) { > + struct page *page = pvec->pages[i]; > struct pglist_data *pagepgdat = page_pgdat(page); > > pgscanned++; > @@ -4233,4 +4232,5 @@ void check_move_unevictable_pages(struct page **pages, int nr_pages) > spin_unlock_irq(&pgdat->lru_lock); > } > } > +EXPORT_SYMBOL(check_move_unevictable_pages); > #endif /* CONFIG_SHMEM */ > -- > 2.19.1.930.g4563a0d9d0-goog > -- Michal Hocko SUSE Labs