From patchwork Tue Oct 16 17:42:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuo-Hsin Yang X-Patchwork-Id: 10643935 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D2AD3B73 for ; Tue, 16 Oct 2018 17:44:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BD082A52D for ; Tue, 16 Oct 2018 17:44:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5001F2A583; Tue, 16 Oct 2018 17:44:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC1662A575 for ; Tue, 16 Oct 2018 17:44:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BF0916B0008; Tue, 16 Oct 2018 13:44:14 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BC8276B000A; Tue, 16 Oct 2018 13:44:14 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AB7386B000C; Tue, 16 Oct 2018 13:44:14 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by kanga.kvack.org (Postfix) with ESMTP id 3BFBF6B0008 for ; Tue, 16 Oct 2018 13:44:14 -0400 (EDT) Received: by mail-lf1-f71.google.com with SMTP id y12-v6so1268240lfh.16 for ; Tue, 16 Oct 2018 10:44:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=mEkDkq8SSZbY2c+Iu2qL96meHyq3EfhnFHqS9BV+RyA=; b=nC+EGniQhQHO6dTWc2ClVa3902WnyNfYAXgzhjcrw8ALHkcPSUsjJVqqPCpZlBJ0Gq i+Z4nFbygod52c8tqVi/N/uSdH7qAHWIanmiHNn3292Njkq/3lq7ylVtZC1IdHKpVFtP EA8w49Wr3TeeyvGvVorXGObcebe+/yvAAPleJYFJACF9tjEqwo0VEglidV60hAISz3k7 kii5yqvUDz6kDo6ufRodYvqbUAboCbFBkNRa69yUK4cKdsLJxxtfRkyrA34Cbyya5ZVq Zxnihdmiu/IiU3qZ6HE5lnImLzhoNoMsovM8mT/HUqA7iU+tXNN/oxWEUiz6/Z9/bjrf Fu8Q== X-Gm-Message-State: ABuFfogyb5b6+fwq38hyiK7a09PDJvujqiXs4HvgbqOVswPR42ecPKtI ZsJGBCogL95V279it78oDAHSBaU+ASBQRL6YOmV1hSBBO/6WsyFAatP+tdR8VLmAjXHvl3AkS+C /DB3TXV1ZZ68c1DBElJrIlvPPCCvAZt81JxZ2Q3bFiyXPgnYxBS24ZHUv4pKK2AB04Vz7it4hzu SkQ2MgQb9wjwo0e9R1LS8NaRyQwcMnEyZUt4zW/yUQuliT7P6IRT18MVsDt97WhABxPgVXt4IR5 cPofAK6SUn/k51+LWtMf0sj2RXAnoDyc69ZgOgSP5ZGAT7JbuxRE32R4Bj0ofOEAktXBROl0k3+ wb5QvxTIHJ3vcLcsVqLQszUTNf1qsJDzLrOJYimQ4UvkJAB+m4UCdfpqvFZiYc++5dZTDJswiOg 8 X-Received: by 2002:a19:cc97:: with SMTP id c145-v6mr13155641lfg.145.1539711853455; Tue, 16 Oct 2018 10:44:13 -0700 (PDT) X-Received: by 2002:a19:cc97:: with SMTP id c145-v6mr13155600lfg.145.1539711852520; Tue, 16 Oct 2018 10:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539711852; cv=none; d=google.com; s=arc-20160816; b=apckSl1a7k33yTfzKkAme3egocCTvop+VILLQva/k1fSG8+pwp9xek4AmFIcbe42gN A+Pc1Rl5nfeOxWQPMHj+kZlYYq3P1uxMnAsXwI2LA8LGubP+v/6WYjjgX7jkUYLBEgBp dc26CB2LPZpdtzeiGrmphuJy2yqoWD3KnJadbKlign6fFxhHOKFZiBvfPLd1g32V/Bkh hiNqhfoOMT+1d+pXcViMWLQ947pbvezLqim8YtGVe8oeYOuZl3jmnHHm1fWTHHivcqg/ lkmVCxYa5Ntu8yC8NbKvjDFHU7TvOv5XEOYGftmQY4bKdn1mOVavgXuPaVS0126Xeqq0 CK2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=mEkDkq8SSZbY2c+Iu2qL96meHyq3EfhnFHqS9BV+RyA=; b=SkNG8RRHmKSkXuc5G0ECgA3n6+lK373yizGkPB3M2TBckCSAr0FTdu+cUZxtXyZso6 /XT23o8r9sdT4WE0P8/wexLpUFUuek9Z4Oht6zNcMHxgFJwiAv9yqW8Ptiv946gi2cda lJlQ2M4KkWzKuQ//3/1cPhcJFW5Cnquc80ui6kW6kUbn/lfiLVVTzucJ3pmkRb4CYRvL 8etzX/2AV1G+3BYFIfH4oWnmaUx1A4fFIP5OYVomiuYgL3iUX15BrFC/ND8R0uMHBQCJ aoxFZhI+8Jr1sgTXvML6TV1062lQ9yGUnTZNZNmnLwIoqBjvjsmiAuGF+Rhs9K/8wt9z p7qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=g5uP2ofi; spf=pass (google.com: domain of vovoy@chromium.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=vovoy@chromium.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id m15-v6sor3966816lfh.11.2018.10.16.10.44.12 for (Google Transport Security); Tue, 16 Oct 2018 10:44:12 -0700 (PDT) Received-SPF: pass (google.com: domain of vovoy@chromium.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=g5uP2ofi; spf=pass (google.com: domain of vovoy@chromium.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=vovoy@chromium.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mEkDkq8SSZbY2c+Iu2qL96meHyq3EfhnFHqS9BV+RyA=; b=g5uP2ofiPqj7kaR3JdlcXzMjwPGUOxnbP9LuWSWLU0jBtolgmcyY2aQ2VLEoB41F+v 2X+hTlP/n3gPiZBmCKytkBl8NeRQifio25fWMbV91vATKtctT2Qe2uRVQXw1tcNWbPG8 FZiWaF+cbzXqE0dKTSXyU7vBKNdzHz9/FpeSs= X-Google-Smtp-Source: ACcGV60nFbvwikFVXSESF2pguXxrdXPNIzbYkIPGv8k7PlEXBKDFDkUR+r0nBXDDysEQ1HlkaJEG/g== X-Received: by 2002:a19:6803:: with SMTP id d3-v6mr1916502lfc.45.1539711852067; Tue, 16 Oct 2018 10:44:12 -0700 (PDT) Received: from vovoy-z840.tpe.corp.google.com ([2401:fa00:1:b:d89e:cfa6:3c8:e61b]) by smtp.gmail.com with ESMTPSA id r4-v6sm3358752ljg.12.2018.10.16.10.44.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Oct 2018 10:44:11 -0700 (PDT) From: Kuo-Hsin Yang To: linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-mm@kvack.org Cc: mhocko@suse.com, akpm@linux-foundation.org, chris@chris-wilson.co.uk, peterz@infradead.org, dave.hansen@intel.com, corbet@lwn.net, hughd@google.com, joonas.lahtinen@linux.intel.com, marcheu@chromium.org, hoegsberg@chromium.org, Kuo-Hsin Yang Subject: [PATCH 1/2] shmem: export shmem_unlock_mapping Date: Wed, 17 Oct 2018 01:42:59 +0800 Message-Id: <20181016174300.197906-2-vovoy@chromium.org> X-Mailer: git-send-email 2.19.1.331.ge82ca0e54c-goog In-Reply-To: <20181016174300.197906-1-vovoy@chromium.org> References: <20181016174300.197906-1-vovoy@chromium.org> MIME-Version: 1.0 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: X-Virus-Scanned: ClamAV using ClamSMTP By exporting this function, drivers can mark/unmark a shmemfs address space as unevictable in the following way: 1. mark an address space as unevictable with mapping_set_unevictable(), pages in the address space will be moved to unevictable list in vmscan. 2. mark an address space evictable with mapping_clear_unevictable(), and move these pages back to evictable list with shmem_unlock_mapping(). Signed-off-by: Kuo-Hsin Yang --- Documentation/vm/unevictable-lru.rst | 4 +++- mm/shmem.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/vm/unevictable-lru.rst b/Documentation/vm/unevictable-lru.rst index fdd84cb8d511..a812fb55136d 100644 --- a/Documentation/vm/unevictable-lru.rst +++ b/Documentation/vm/unevictable-lru.rst @@ -143,7 +143,7 @@ using a number of wrapper functions: Query the address space, and return true if it is completely unevictable. -These are currently used in two places in the kernel: +These are currently used in three places in the kernel: (1) By ramfs to mark the address spaces of its inodes when they are created, and this mark remains for the life of the inode. @@ -154,6 +154,8 @@ These are currently used in two places in the kernel: swapped out; the application must touch the pages manually if it wants to ensure they're in memory. + (3) By the i915 driver to mark pinned address space until it's unpinned. + Detecting Unevictable Pages --------------------------- diff --git a/mm/shmem.c b/mm/shmem.c index 446942677cd4..d1ce34c09df6 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -786,6 +786,7 @@ void shmem_unlock_mapping(struct address_space *mapping) cond_resched(); } } +EXPORT_SYMBOL_GPL(shmem_unlock_mapping); /* * Remove range of pages and swap entries from radix tree, and free them. @@ -3874,6 +3875,7 @@ int shmem_lock(struct file *file, int lock, struct user_struct *user) void shmem_unlock_mapping(struct address_space *mapping) { } +EXPORT_SYMBOL_GPL(shmem_unlock_mapping); #ifdef CONFIG_MMU unsigned long shmem_get_unmapped_area(struct file *file, From patchwork Tue Oct 16 17:43:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuo-Hsin Yang X-Patchwork-Id: 10643939 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3E10C13AD for ; Tue, 16 Oct 2018 17:44:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AADD2A52D for ; Tue, 16 Oct 2018 17:44:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F1D12A583; Tue, 16 Oct 2018 17:44:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CB5D2A52D for ; Tue, 16 Oct 2018 17:44:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 629066B000C; Tue, 16 Oct 2018 13:44:22 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5D4A36B000D; Tue, 16 Oct 2018 13:44:22 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4EAF56B000E; Tue, 16 Oct 2018 13:44:22 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by kanga.kvack.org (Postfix) with ESMTP id D39546B000C for ; Tue, 16 Oct 2018 13:44:21 -0400 (EDT) Received: by mail-lj1-f200.google.com with SMTP id r24-v6so6437908ljr.18 for ; Tue, 16 Oct 2018 10:44:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=bzoh24FV/7+GlpJwWqjLaXQi/cwzbPAc9pGvjk3V9fU=; b=Qms+78d1vkKjsiLu7hnfMTSIV7MPT19kOEY5zRrz/LM2wT9J2tF7Ia36vj5y/76hrl 7XvKxNAWyadds7tjbqwuAWOgzNuL93/WqQwFEzpe5lBRWachGrShn/A6nyYZk0EGqL0R UtrrOQVlHo059ImeNf3eRpwpEeyPbFDGpOrqw0tkVpnAduEMWxjBQGNQ6rqPkoQ/S0AV ZiiAQgxTnSk5QtZlObBAih/Ptzonx3x9xAm8ojmZp06ZY+BDIvJaTDpF8AAyRmAIfeXR t0DJoy8YD8+oKc/tfgDqfJWkAm7uep05WJnPV0+U3RvRX2/XIJ6MgIw4fjg56xdNXgd+ o7dQ== X-Gm-Message-State: ABuFfogBClrVGwz8maXnIMhGsm9Nz5i0g5ssSpoPK689CbdotlzkYbMu LebnBVGSLw+gulfXtRZUUx4jVbxU8dV30EKc9p1+PlgtMM93hCDet6IlheLO3RIPrLHFSjfyHqc 9MrGSluQ/pRx977+BMqKRuuqFzrp6AZmHcr9nRcR/Fk/T0AvsZ0flIUnIeuAqu4HPIhe0byj7QJ 3XvQISz4j9ZTUlDvlK9x/hju63MlhutJ/nUdvjTNFFsaj9pQ28n9liTv/BF+hnzaFeHnAbTDxGn hCHYiiigK6RnUXEp8cFnhQwh8n2lA2SAx57WYSXez/m6h+87SmT0t0uis4Z3E/y4N2D9FFiAyaT bWpzTfdzoXsxZP+4IxbGkmvZ+SP35JhrUH6XgXeyrmNqW89wALRwhuLhV+9r+pLBgBVY/oFtMuf v X-Received: by 2002:a19:2381:: with SMTP id j123-v6mr13771817lfj.137.1539711861238; Tue, 16 Oct 2018 10:44:21 -0700 (PDT) X-Received: by 2002:a19:2381:: with SMTP id j123-v6mr13771770lfj.137.1539711860120; Tue, 16 Oct 2018 10:44:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539711860; cv=none; d=google.com; s=arc-20160816; b=iZWCPDWNlKKglGKzPb/bMFO42ojDEGsxi7Ws/HA+bgeVEBRV5h0JI2U+1kO4a/PqMc eT+d51ViUARGGlxoVZvqWVFjYEVmVf5vafJyjpgP4RcAGgJpKlnvrbcbemJhlPzgLzJk 2dliiyIgQlhlqWQWpRK2uWym6exq3T0osuu6o2Q9NkH8a/qKVz6P2IM7YjFhp1/vPYtf tTiCtn8dRpZ/h5eAvBpphy+CE4SVtQaCxw0C4q01CxSxEQdnirC8W1LGfgyBdpDL9tA3 bvPUK4if1JXMqioTHnSnUs8QSDYRoW/z4H7pw0u/s3w47NUGs5d8JyzijVYW8Tv/hoTV LMGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=bzoh24FV/7+GlpJwWqjLaXQi/cwzbPAc9pGvjk3V9fU=; b=IOfBrPh2X2z2Sj5czG3sqJUjD3AoTlRaAS+kOa2aDhkxWx6F7RaJ6RMba3dVSLaMtT VGyLnOHkfFZ8BJOsuYDi4dHjfD/2oWIG//c5BlLJxQNboHei+hHyKHwjAZmiyPt7IBgW 8S6RDgJLbZkDhsjUbKuaqDqtXR1NrwAmaToIQPftSUatW5Oh0qQJDbJjtmZf+e45+bo4 M2e1qUMv+GnXZAj7Zz/MHE4ODxByTkZRrtGHVXhCBMdo6+oODieKV8xLjw3JAu/H5/jc 8QNAvmtkNl2W8qF1lBBCjBJ7Uu5fpcoYdWR7ColfDd/QPrbTO/djYcCZ4hxZYtE4qzmS W8dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VZZhVILC; spf=pass (google.com: domain of vovoy@chromium.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=vovoy@chromium.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id z4-v6sor3890102lfh.21.2018.10.16.10.44.19 for (Google Transport Security); Tue, 16 Oct 2018 10:44:20 -0700 (PDT) Received-SPF: pass (google.com: domain of vovoy@chromium.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VZZhVILC; spf=pass (google.com: domain of vovoy@chromium.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=vovoy@chromium.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bzoh24FV/7+GlpJwWqjLaXQi/cwzbPAc9pGvjk3V9fU=; b=VZZhVILCqYnAIQ0Py1aB7+7AmPOkaeE42RVE8Jhj5JjdVWhdRtXT5WK3yofvwHmQVn PGP0OpMO7hf88Xvqbfs4AHKY8iJ2C67Wy3FUjpwdP8boe7g6qsahf16u9vpsP4Wzskb2 eD+ckhpDdC0AbactZRmfpNBMf2wOQArMz1fbo= X-Google-Smtp-Source: ACcGV62NYrZwT28IR8MFmwZZbGFLRCdcvOqrPlbCNvCo/CrBJwnz8ZmnbPe9xxOhhusMsEOHtDlhMQ== X-Received: by 2002:a19:8fce:: with SMTP id s75mr1747685lfk.151.1539711859597; Tue, 16 Oct 2018 10:44:19 -0700 (PDT) Received: from vovoy-z840.tpe.corp.google.com ([2401:fa00:1:b:d89e:cfa6:3c8:e61b]) by smtp.gmail.com with ESMTPSA id r4-v6sm3358752ljg.12.2018.10.16.10.44.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Oct 2018 10:44:19 -0700 (PDT) From: Kuo-Hsin Yang To: linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-mm@kvack.org Cc: mhocko@suse.com, akpm@linux-foundation.org, chris@chris-wilson.co.uk, peterz@infradead.org, dave.hansen@intel.com, corbet@lwn.net, hughd@google.com, joonas.lahtinen@linux.intel.com, marcheu@chromium.org, hoegsberg@chromium.org, Kuo-Hsin Yang Subject: [PATCH 2/2] drm/i915: Mark pinned shmemfs pages as unevictable Date: Wed, 17 Oct 2018 01:43:00 +0800 Message-Id: <20181016174300.197906-3-vovoy@chromium.org> X-Mailer: git-send-email 2.19.1.331.ge82ca0e54c-goog In-Reply-To: <20181016174300.197906-1-vovoy@chromium.org> References: <20181016174300.197906-1-vovoy@chromium.org> MIME-Version: 1.0 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: X-Virus-Scanned: ClamAV using ClamSMTP The i915 driver use 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. Mark these pinned pages as unevictable to speed up vmscan. Signed-off-by: Kuo-Hsin Yang --- drivers/gpu/drm/i915/i915_gem.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index fcc73a6ab503..e0ff5b736128 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2390,6 +2390,7 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj, { struct sgt_iter sgt_iter; struct page *page; + struct address_space *mapping; __i915_gem_object_release_shmem(obj, pages, true); @@ -2409,6 +2410,10 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj, } obj->mm.dirty = false; + mapping = file_inode(obj->base.filp)->i_mapping; + mapping_clear_unevictable(mapping); + shmem_unlock_mapping(mapping); + sg_free_table(pages); kfree(pages); } @@ -2551,6 +2556,7 @@ static int i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj) * Fail silently without starting the shrinker */ mapping = obj->base.filp->f_mapping; + mapping_set_unevictable(mapping); noreclaim = mapping_gfp_constraint(mapping, ~__GFP_RECLAIM); noreclaim |= __GFP_NORETRY | __GFP_NOWARN; @@ -2664,6 +2670,8 @@ static int i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj) err_pages: for_each_sgt_page(page, sgt_iter, st) put_page(page); + mapping_clear_unevictable(mapping); + shmem_unlock_mapping(mapping); sg_free_table(st); kfree(st);