From patchwork Thu Oct 3 00:51:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 20754 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f71.google.com (mail-qe0-f71.google.com [209.85.128.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ACE0E238F9 for ; Thu, 3 Oct 2013 00:52:10 +0000 (UTC) Received: by mail-qe0-f71.google.com with SMTP id a11sf3590815qen.6 for ; Wed, 02 Oct 2013 17:52:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=VsVprgL0cLgqt2dAbXvk/vvvkEBNNlC6y+nIyp4aOkw=; b=OFcG6EfE7ypo+ylDc5GQLR1jOL8kAi97XzKZneAG1NfRB6hd6+xHoFfFDs+WZ7qDlX sptoxlMkhRbVN9Ps/aO9Qbfnf161qvLCfTb7Uztr+QmEO+MLT0QBgpCzXd3d3qF5v1Az BsJqUU6X1a9q1tyBjHAqnsH6dmsbeuLL3XK0Jgg5jg+wbwdd3uOKoMrmyygQdHg5M55P YXeYYoSVZowvuVqPA8lZa/71rN9qitC3mU2rLyM7JaoX8t5eduFVJ0+OkMvs93+CjVjm aYHbmeMBpSquWfqCCMUvZvoVyj5n8Q/KNaE0oBXIvrfaZUuzzf3a3m4xNMhbgas9accA JCKg== X-Received: by 10.236.88.129 with SMTP id a1mr4509856yhf.40.1380761530556; Wed, 02 Oct 2013 17:52:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.51.40 with SMTP id h8ls787777qeo.28.gmail; Wed, 02 Oct 2013 17:52:10 -0700 (PDT) X-Received: by 10.220.199.5 with SMTP id eq5mr4686976vcb.16.1380761530371; Wed, 02 Oct 2013 17:52:10 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id dt10si1048703vdb.8.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Oct 2013 17:52:10 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jz11so1243654veb.39 for ; Wed, 02 Oct 2013 17:52:10 -0700 (PDT) X-Gm-Message-State: ALoCoQmit1UgU0rR0CxN9+a3GWh6zXAUApNKpaorFkeuBOv+/rREH0aomR25zIQfuGLcbgxggAnP X-Received: by 10.221.40.10 with SMTP id to10mr4341189vcb.22.1380761530225; Wed, 02 Oct 2013 17:52:10 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp137510vcz; Wed, 2 Oct 2013 17:52:09 -0700 (PDT) X-Received: by 10.66.136.131 with SMTP id qa3mr6097688pab.77.1380761529321; Wed, 02 Oct 2013 17:52:09 -0700 (PDT) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by mx.google.com with ESMTPS id cj2si3111613pbc.327.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Oct 2013 17:52:09 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.47 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.220.47; Received: by mail-pa0-f47.google.com with SMTP id kp14so1796131pab.6 for ; Wed, 02 Oct 2013 17:52:09 -0700 (PDT) X-Received: by 10.66.251.1 with SMTP id zg1mr6013653pac.160.1380761528888; Wed, 02 Oct 2013 17:52:08 -0700 (PDT) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id gh2sm4507018pbc.40.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Oct 2013 17:52:08 -0700 (PDT) From: John Stultz To: LKML Cc: John Stultz , Andrew Morton , Android Kernel Team , Robert Love , Mel Gorman , Hugh Dickins , Dave Hansen , Rik van Riel , Dmitry Adamushko , Dave Chinner , Neil Brown , Andrea Righi , Andrea Arcangeli , "Aneesh Kumar K.V" , Mike Hommey , Taras Glek , Dhaval Giani , Jan Kara , KOSAKI Motohiro , Michel Lespinasse , Rob Clark , Minchan Kim , "linux-mm@kvack.org" Subject: [PATCH 04/14] vrange: Add support for volatile ranges on file mappings Date: Wed, 2 Oct 2013 17:51:33 -0700 Message-Id: <1380761503-14509-5-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1380761503-14509-1-git-send-email-john.stultz@linaro.org> References: <1380761503-14509-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Like with the mm struct, this patch add basic support for volatile ranges on file address_space structures. This allows for volatile ranges to be set on mmapped files that can be shared between processes. The semantics on the volatile range sharing is that the volatility is shared, just as the data is shared. Thus if one process marks the range as volatile, the data is volatile in all processes that have those pages mapped. It is advised that processes coordinate when using volatile ranges on shared mappings (much as they must coordinate when writing to shared data). Cc: Andrew Morton Cc: Android Kernel Team Cc: Robert Love Cc: Mel Gorman Cc: Hugh Dickins Cc: Dave Hansen Cc: Rik van Riel Cc: Dmitry Adamushko Cc: Dave Chinner Cc: Neil Brown Cc: Andrea Righi Cc: Andrea Arcangeli Cc: Aneesh Kumar K.V Cc: Mike Hommey Cc: Taras Glek Cc: Dhaval Giani Cc: Jan Kara Cc: KOSAKI Motohiro Cc: Michel Lespinasse Cc: Rob Clark Cc: Minchan Kim Cc: linux-mm@kvack.org Signed-off-by: John Stultz --- fs/inode.c | 4 ++++ include/linux/fs.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/fs/inode.c b/fs/inode.c index d6dfb09..5364f91 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -17,6 +17,7 @@ #include #include /* for inode_has_buffers */ #include +#include #include "internal.h" /* @@ -352,6 +353,7 @@ void address_space_init_once(struct address_space *mapping) spin_lock_init(&mapping->private_lock); mapping->i_mmap = RB_ROOT; INIT_LIST_HEAD(&mapping->i_mmap_nonlinear); + vrange_root_init(&mapping->vroot, VRANGE_FILE, mapping); } EXPORT_SYMBOL(address_space_init_once); @@ -1419,6 +1421,8 @@ static void iput_final(struct inode *inode) inode_lru_list_del(inode); spin_unlock(&inode->i_lock); + vrange_root_cleanup(&inode->i_mapping->vroot); + evict(inode); } diff --git a/include/linux/fs.h b/include/linux/fs.h index 9818747..6ec2953 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -413,6 +414,9 @@ struct address_space { struct rb_root i_mmap; /* tree of private and shared mappings */ struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ struct mutex i_mmap_mutex; /* protect tree, count, list */ +#ifdef CONFIG_MMU + struct vrange_root vroot; +#endif /* Protected by tree_lock together with the radix tree */ unsigned long nrpages; /* number of total pages */ pgoff_t writeback_index;/* writeback starts here */