Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5471843imm; Tue, 16 Oct 2018 10:44:52 -0700 (PDT) X-Google-Smtp-Source: ACcGV63oMNkAAUC29v6kFsthYjWLqXOaNg7EChZJu/nEhJODPL03qoklBOWpL1TpVo57F/Ls4J94 X-Received: by 2002:a63:64c2:: with SMTP id y185-v6mr20833745pgb.411.1539711892349; Tue, 16 Oct 2018 10:44:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539711892; cv=none; d=google.com; s=arc-20160816; b=J07n4yiuoomw2QonPsWteB/tocXbHgZJSQbGPh/P29JY2E/tyyveJ115auE1AspE04 u1IB85nSZpaBGMLcPB8jPTbD0+xO+f430sOCwLVJg5PbluYImuYX550GRoonKQO8Bwk0 cne06wo+gJFBh1OjU/2od3YGHZ93J5es9lhQVa02phRgoX15mCBboly+jF9184fMLjRl rH4UmiKzFkSSO2XJN19kRZ3pVYkaxcUGWDh3+/m6m2Pjhw8qAcWwIOtHmE0TiVZFCfuX 64Fzvk4U/xkyBAUSzcf+vqSXEpb47AotOSl57BjzlcPrxvAFe2MCbvhI+3HEKZFNzmMK lZRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mEkDkq8SSZbY2c+Iu2qL96meHyq3EfhnFHqS9BV+RyA=; b=M1z6BjcXGEjAuTZP397Rpe3s8NTrZMLhZJrcFqjJU15DFPw0T4HcmWn7OmlhPfopGH SppCiy8t9GQr+8r/lO0GcXOkxkoncnAaceZrzOgz33a3ABTVl+bGDDLQF4D+pffEnXy0 B2tpdM5KY+PLsJAqusJINT24snhndH9V3gtTaWv+RZYZrpZ7vftMdSceL8fUBkQRh19Z GLB9X5GkXyxXWV1in40tifoA0tvmV/nWRE/gUncAE8JXAQZETqmSZXohjaL55BJi5zCI 0aZktvBQnKD97dzloCk+pBsScx/Cb6XumCtjD3XJcsknuSifuYOLx9QvGpNc5R8xFNHW PWRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=g5uP2ofi; 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 b65-v6si15563108pfe.265.2018.10.16.10.44.36; Tue, 16 Oct 2018 10:44:52 -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; dkim=pass header.i=@chromium.org header.s=google header.b=g5uP2ofi; 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 S1727553AbeJQBfq (ORCPT + 99 others); Tue, 16 Oct 2018 21:35:46 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:39304 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727433AbeJQBfq (ORCPT ); Tue, 16 Oct 2018 21:35:46 -0400 Received: by mail-lf1-f68.google.com with SMTP id n14-v6so5794494lfe.6 for ; Tue, 16 Oct 2018 10:44:13 -0700 (PDT) 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-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mEkDkq8SSZbY2c+Iu2qL96meHyq3EfhnFHqS9BV+RyA=; b=srWDpCbBaPAQbVyaMB91MtC5JMvC507IQjCl9CCITFnzR3+LVJNm6OIEgWwcpxLCOh 9VnKdCnRfaYp9XqM7BobUaTItsSLPe+0DO7Isyid9fFo/zcqQSxVufUtjSxdUqI012uC fXY1u2PbBwoybXpDRNhgZe/BDMu5ARU3nzg9DYxznMq5sV4L7mA9tT9e3hH8iO9UJCOk qZ4k2IJOImdw+6AN4tJTKzwyRAH0HVFQjoN/apAkuSwTa9z8r5x1JWwS4yqeYVasY+Yl S4hmSaFfjS3bcebAJRJjE69DzReq62rd4TPh83oiMbBylg3mIBh5M1PQP0T6uMz/4d+m hf4w== X-Gm-Message-State: ABuFfog8B8wcYROu3q33rOhK5io2mv4LqFBm2mUOhy6vcrOhrdrHWy22 QGEVfNc6egk0SvLrGxNnva4DBjmWopYY 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, -- 2.19.1.331.ge82ca0e54c-goog