Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758088AbbDXQnN (ORCPT ); Fri, 24 Apr 2015 12:43:13 -0400 Received: from mail-lb0-f170.google.com ([209.85.217.170]:35745 "EHLO mail-lb0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757857AbbDXQnJ (ORCPT ); Fri, 24 Apr 2015 12:43:09 -0400 MIME-Version: 1.0 In-Reply-To: References: Date: Fri, 24 Apr 2015 17:43:08 +0100 Message-ID: Subject: Re: Regression: Requiring CAP_SYS_ADMIN for /proc//pagemap causes application-level breakage From: Mark Williamson To: Mark Seaborn Cc: kernel list , "Kirill A. Shutemov" , Pavel Emelyanov , Konstantin Khlebnikov , Andrew Morton , Linus Torvalds , Andy Lutomirski , linux-api@vger.kernel.org, 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: 1659 Lines: 36 Hi Mark, On Fri, Apr 24, 2015 at 4:26 PM, Mark Seaborn wrote: > I'm curious, what do you use the physical page addresses for? > > Since you pointed to http://undo-software.com, which talks about > reversible debugging tools, I can guess you would use the soft-dirty > flag to implement copy-on-write snapshotting. I'm guessing you might > use physical page addresses for determining when the same page is > mapped twice (in the same process or different processes)? That's pretty much it. Actually, we're effectively using the physical addresses to emulate soft-dirty. For certain operations (e.g. some system calls) we need to track what memory has changed since we last looked at the process state. We have a mechanism that forks a child process, runs the system call, then refers to pagemap to figure out what's been modified. Currently, our mechanism compares the physical addresses of pages before and after the syscall so that we can see which pages got CoWed. This is perhaps a slightly "unconventional" use of the interface but we support kernels that predate the soft-dirty mechanism and (as far as we know) this is probably the best way we can answer "What got changed?" on those releases. Using the soft-dirty mechanism where available should make our code both cleaner and faster, so if we can fix the pagemap file to allow that then we'll be quite happy! Cheers, Mark -- 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/