From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752664AbcDZAJd (ORCPT ); Mon, 25 Apr 2016 20:09:33 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58554 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752081AbcDZAJL (ORCPT ); Mon, 25 Apr 2016 20:09:11 -0400 Date: Mon, 25 Apr 2016 17:09:09 -0700 From: Andrew Morton To: Rich Felker Cc: linux-kernel@vger.kernel.org, Michal Hocko , Greg Ungerer , Geert Uytterhoeven , Yoshinori Sato Subject: Re: [PATCH] tmpfs: fix VM_MAYSHARE mappings for NOMMU Message-Id: <20160425170909.31cf27c845a9fc19688fd5af@linux-foundation.org> In-Reply-To: <20160422221944.GA14264@brightrain.aerifal.cx> References: <20160422221944.GA14264@brightrain.aerifal.cx> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Apr 2016 18:19:44 -0400 Rich Felker wrote: > Subject: [PATCH] tmpfs: fix VM_MAYSHARE mappings for NOMMU I take it that "ramfs" was intended here. > The nommu do_mmap expects f_op->get_unmapped_area to either succeed or > return -ENOSYS for VM_MAYSHARE (e.g. private read-only) mappings. > Returning addr in the non-MAP_SHARED case was completely wrong, and > only happened to work because addr was 0. However, it prevented > VM_MAYSHARE mappings from sharing backing with the fs cache, and > forced such mappings (including shareable program text) to be copied > whenever the number of mappings transitioned from 0 to 1, impacting > performance and memory usage. Subsequent mappings beyond the first > still correctly shared memory with the first. > > Instead, treat VM_MAYSHARE identically to VM_SHARED at the file ops > level; do_mmap already handles the semantic differences between them. > > ... >