Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751214AbbD2UoL (ORCPT ); Wed, 29 Apr 2015 16:44:11 -0400 Received: from mail-lb0-f181.google.com ([209.85.217.181]:34721 "EHLO mail-lb0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751051AbbD2UoH (ORCPT ); Wed, 29 Apr 2015 16:44:07 -0400 MIME-Version: 1.0 In-Reply-To: References: <20150429193622.GA11892@node.dhcp.inet.fi> Date: Wed, 29 Apr 2015 23:44:04 +0300 Message-ID: Subject: Re: Regression: Requiring CAP_SYS_ADMIN for /proc//pagemap causes application-level breakage From: Konstantin Khlebnikov To: Linus Torvalds Cc: "Kirill A. Shutemov" , Mark Williamson , Mark Seaborn , kernel list , "Kirill A. Shutemov" , Pavel Emelyanov , Andrew Morton , Andy Lutomirski , Linux API , Finn Grimwood , Daniel James Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1431 Lines: 41 On Wed, Apr 29, 2015 at 11:33 PM, Linus Torvalds wrote: > On Wed, Apr 29, 2015 at 12:36 PM, Kirill A. Shutemov > wrote: >> >> Emm.. I have hard time to understand how writable bit is enough to get >> soft-dirty-alike functionality. > > I don't think it is. > > For anonymous pages, maybe you can play tricks with comparing the page > 'anon_vma' with the vma->anon_vma. > > I haven't really thought that through, but does something like > > static inline bool page_is_dirty_in_vma(struct page *page, struct > vm_area_struct *vma) > { > struct anon_vma *anon_vma = vma->anon_vma; > > return page->mapping == (void *)anon_vma + PAGE_MAPPING_ANON; > } > > end up working as a "page has been dirtied in this mapping"? This's no longer true. After recent fixes for "anon_vma endless growing" new vma might reuse old anon_vma from grandparent vma. > > If the page came from another process and hasn't been written to, it > will have the anon_vma pointing to the originalting vma. > > I may be high on some bad drugs, though. As mentioned, I didn't really > think this through. > > Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/