Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp635909imu; Mon, 5 Nov 2018 06:35:44 -0800 (PST) X-Google-Smtp-Source: AJdET5eQaw+fQ3RwgWdnyMuaZIgF2Fhy6eE/qLuSJ40c8kTfyyiullEq/R4btGfT0SUSyyc36GZN X-Received: by 2002:a65:55ca:: with SMTP id k10mr20202501pgs.448.1541428543934; Mon, 05 Nov 2018 06:35:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541428543; cv=none; d=google.com; s=arc-20160816; b=AM40teMSvuNiZojYUGasW7Buh4FkePUKGmvvRqq+zw/JHp5M0ZBXnW+QlIxzGfXao/ WyIzOYR1CSOIwLselKlUA5j/94o5nvaGXKK0TjNS+M5w92a6VEZpJ3hCtzn1HOKTmRjN SZFhO7T5QIb26kh/We8B2uUKx7KgdDb9YtpGhZVPvysxZmG/ahuraU7oQU4L0GuBlqZx 5sRm038sChnaCCWnF+iyms/IzrItPFQcPhEE0nMtb2I53416NOL/SOasTE5xkNsMaEfP SAt98GbWEHZcfg+aA5Lka4vBYbv4ljnWIjvYF4fnZbBIIf0Q/GOQ554pEa7ZF4owuTLJ DLaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=cY70111Ih58IqEWv1cT4KftiBxviHf5HTOPzwjhLziU=; b=rigJ6QN6IpexSfNZxX8pOJ4CayrYYTq8v34/7BofQA5ICy1tCnNsrEIrojgqCHOC2F y+bVUrNe2KOplaU99KEORhudDr99aI1M5JZ6343fujpfk8ZbtX3T3aglSjaYtbLOjekz 0SyhVGYY7PmpT+VaN4FfEychg89c48Vl8SBikjWuwlJv+Op2JdvWkc7LRZMz+B+83Drh 5aR+mLKLf+OjT2K5hRkWDMP+RmEtDkEovL7NhibateM4swWAUTrIpGubMbAUxbLLjyZp OeVvZ8JiLIcJKA0iGFUTnEjWbsNI8mk1KJ+LMDm1zkvTLYVgr3I+EiLkd+mqn5wM50kO /akA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ShFM9qWt; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r128-v6si29802643pfc.116.2018.11.05.06.35.25; Mon, 05 Nov 2018 06:35:43 -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; dkim=pass header.i=@chromium.org header.s=google header.b=ShFM9qWt; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729859AbeKEXxZ (ORCPT + 99 others); Mon, 5 Nov 2018 18:53:25 -0500 Received: from mail-oi1-f196.google.com ([209.85.167.196]:38905 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726173AbeKEXxZ (ORCPT ); Mon, 5 Nov 2018 18:53:25 -0500 Received: by mail-oi1-f196.google.com with SMTP id v83-v6so7595745oia.5 for ; Mon, 05 Nov 2018 06:33:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cY70111Ih58IqEWv1cT4KftiBxviHf5HTOPzwjhLziU=; b=ShFM9qWt7EYtC/i4WHk4bBuJrc2vfEikhb5bahRHyOUMz32i5JEJG9MVYU6awLv0ph 624TSKccPRlvbLEMR//Ak3s/0EKjdy7HRe1Sg8em2n1OQCfUVHapGavYhxx5l9ZGjaeC EFIp1P8JuW4zfWzHtAwH8fypn3Qc2gjgkTpKU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cY70111Ih58IqEWv1cT4KftiBxviHf5HTOPzwjhLziU=; b=VqmsKsV2hFxp4xh8ulOBfmyJzPVLxtZQcTn85zRr+PEwZn5o/kwMx4ZKXWoQmmaiwp m5N30k8EByRHXrncA4g2JfIGCppu4atDvhMmewyEehKAk74Tr7bzQq5Y0mQsVQf/Bmvn Gkod7aIpGoalUiTLS3giuBx4JEthZjvH56LikEQAr0/YSxRb/sWYqrzlE5afthAjRQ32 3DKm4nGi98KP5nI7+Z5Ad2XFKi0w3kkmJJBRTmkZS4r4S9aXTjTacPfzYpbsaVS63CJx b85od4SE9lVY+cv+C1+ACIOm3V09Futg4nStL5XxsY75rUaAhMielPiuFrGoRdETyJ+2 I8TA== X-Gm-Message-State: AGRZ1gJDCgQB0of08D2plXyojZGSul/Qz00AyuD4blTErpoy5Vnlh9hz 4UMJ5/4oiqWZzkzue04iuQyRCQeaX/da0+T53x90 X-Received: by 2002:aca:e514:: with SMTP id c20-v6mr13515887oih.75.1541428405068; Mon, 05 Nov 2018 06:33:25 -0800 (PST) MIME-Version: 1.0 References: <20181105111348.182492-1-vovoy@chromium.org> <20181105130209.GI4361@dhcp22.suse.cz> In-Reply-To: <20181105130209.GI4361@dhcp22.suse.cz> From: Kuo-Hsin Yang Date: Mon, 5 Nov 2018 22:33:13 +0800 Message-ID: Subject: Re: [PATCH v4] mm, drm/i915: mark pinned shmemfs pages as unevictable To: mhocko@kernel.org 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 5, 2018 at 9:02 PM Michal Hocko wrote: > > 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. I didn't find a msg-id based url for the [1] patch. This patch is sent to intel-gfx@lists.freedesktop.org and linux-mm@kvack.org, but not to linux-kernel@vger.kernel.org . > > > 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. OK, will keep the original wording. > > > + * @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. OK, this function should not be specific to shmem pages. Is it OK to remove the #ifdef SHMEM surrounding check_move_unevictable_pages? > > 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