From patchwork Tue Oct 1 18:38:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 20728 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9DE2823920 for ; Tue, 1 Oct 2013 18:39:09 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id f12sf8301429vbg.3 for ; Tue, 01 Oct 2013 11:39:09 -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: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=Zpf4aYRGOZRivav7lreO4SffWxFGywcsy2qHkOb7cX+H9Z52ENwbDkF2QhLKpQ6H9h s8Vxdk1SOh9SPvbH3ErpQXgMRsFP7X3cife3WWg+l8Zv4z1ljtCaR4TQoVwNLYXKbSYg lz8kxaVWBndqBLI6WGEy9rcZ9tUyYdbEuumACy7NGLC9GYY+bJYCo4uuRHkStO7eeKxk Yd/CeomyWZIwqkLjxHQBIftB13eUVGIEUfgQmSueDngGeE24tTtyYhidPGZ5cz5Xn4x3 X70O9aKyRCKrMelkfYJBZ29SkUecuOs3+6Tir8Ptzh+vK0kRltEJz2rSnlOt6f6EZ1ar 3x9Q== X-Received: by 10.52.121.34 with SMTP id lh2mr417vdb.6.1380652749394; Tue, 01 Oct 2013 11:39:09 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.14.106 with SMTP id o10ls196520qec.36.gmail; Tue, 01 Oct 2013 11:39:09 -0700 (PDT) X-Received: by 10.220.184.70 with SMTP id cj6mr1980831vcb.23.1380652749292; Tue, 01 Oct 2013 11:39:09 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id dp7si1606141ved.149.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Oct 2013 11:39:09 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.173 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.173; Received: by mail-ve0-f173.google.com with SMTP id cz12so5611988veb.32 for ; Tue, 01 Oct 2013 11:39:09 -0700 (PDT) X-Gm-Message-State: ALoCoQnLfaERK4+xOQ1OlJrbYG2eC+xBe0G+84qqS4k1N7yIxOvaDOZUWqYkiXUGHBWllszNLLzp X-Received: by 10.58.205.195 with SMTP id li3mr1344547vec.31.1380652749155; Tue, 01 Oct 2013 11:39:09 -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 u4csp38603vcz; Tue, 1 Oct 2013 11:39:08 -0700 (PDT) X-Received: by 10.68.196.138 with SMTP id im10mr30415547pbc.127.1380652748167; Tue, 01 Oct 2013 11:39:08 -0700 (PDT) Received: from mail-pd0-f181.google.com (mail-pd0-f181.google.com [209.85.192.181]) by mx.google.com with ESMTPS id is7si5518639pbc.269.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Oct 2013 11:39:08 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.181 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.192.181; Received: by mail-pd0-f181.google.com with SMTP id g10so7660685pdj.12 for ; Tue, 01 Oct 2013 11:39:07 -0700 (PDT) X-Received: by 10.66.168.7 with SMTP id zs7mr10540280pab.152.1380652747410; Tue, 01 Oct 2013 11:39:07 -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 ed3sm8282606pbc.6.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Oct 2013 11:39:06 -0700 (PDT) From: John Stultz To: Minchan Kim , Dhaval Giani Subject: [PATCH 04/14] vrange: Add support for volatile ranges on file mappings Date: Tue, 1 Oct 2013 11:38:48 -0700 Message-Id: <1380652738-8000-5-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1380652738-8000-1-git-send-email-john.stultz@linaro.org> References: <1380652738-8000-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.173 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 */