Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751626Ab0F0EjG (ORCPT ); Sun, 27 Jun 2010 00:39:06 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:53298 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750900Ab0F0EjB convert rfc822-to-8bit (ORCPT ); Sun, 27 Jun 2010 00:39:01 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; b=IpGRScG5wlnO6Gp9cHcMnYeewYObbmG90bmbzwYg6lMxorFL4RCbI8Wtyca74bqGNN nNwS6kR8SU5YKbXdjEju3PGqJGZIp3SCncCZbqwV0j+Nb8Hg2MbfJtBvNPIpoqXO24ZQ zCgN54ky0d55cL+mqtXr3nLOrV0aIhBNrO70o= MIME-Version: 1.0 Reply-To: mtk.manpages@gmail.com In-Reply-To: <20100626233029.GA8820@localhost> References: <20100619132055.GK18946@basil.fritz.box> <20100619133000.GL18946@basil.fritz.box> <20100619140933.GM18946@basil.fritz.box> <20100619195242.GS18946@basil.fritz.box> <20100620071446.GA21743@localhost> <20100626233029.GA8820@localhost> From: Michael Kerrisk Date: Sun, 27 Jun 2010 06:38:39 +0200 Message-ID: Subject: Re: [PATCH] [31/31] HWPOISON: Add a madvise() injector for soft page offlining To: Wu Fengguang Cc: Andi Kleen , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4199 Lines: 103 On Sun, Jun 27, 2010 at 1:30 AM, Wu Fengguang wrote: > On Sat, Jun 26, 2010 at 09:18:52PM +0800, Michael Kerrisk wrote: >> Hi Fengguang, >> >> On Sun, Jun 20, 2010 at 9:14 AM, Wu Fengguang wrote: >> > On Sun, Jun 20, 2010 at 02:19:35PM +0800, Michael Kerrisk wrote: >> >> Hi Andi, >> >> On Sat, Jun 19, 2010 at 9:52 PM, Andi Kleen wrote: >> >> >> .TP >> >> >> .BR MADV_SOFT_OFFLINE " (Since Linux 2.6.33) >> >> >> Soft offline the pages in the range specified by >> >> >> .I addr >> >> >> and >> >> >> .IR length . >> >> >> This memory of each page in the specified range is copied to a new page, >> >> > >> >> > Actually there are some cases where it's also dropped if it's cached page. >> >> > >> >> > Perhaps better would be something more fuzzy like >> >> > >> >> > "the contents are preserved" >> >> >> >> The problem to me is that this gets so fuzzy that it's hard to >> >> understand the meaning (I imagine many readers will ask: "What does it >> >> mean that the contents are preserved"?). Would you be able to come up >> >> with a wording that is a little miore detailed? >> > >> > That is, MADV_SOFT_OFFLINE won't lose data. >> > >> > If a process writes "1" to some virtual address and then called >> > madvice(MADV_SOFT_OFFLINE) on that virtual address, it can continue >> > to read "1" from that virtual address. >> > >> > MADV_SOFT_OFFLINE "transparently" replaces the underlying physical page >> > frame with a new one that contains the same data "1". The original page >> > frame is offlined, and the new page frame may be installed lazily. >> >> Thanks. That helps me come up with a description that is I think a bit clearer: >> >> ? ? ? ?MADV_SOFT_OFFLINE (Since Linux 2.6.33) >> ? ? ? ? ? ? ? Soft offline the pages in the range specified by >> ? ? ? ? ? ? ? addr and length. ?The memory of each page in the >> ? ? ? ? ? ? ? specified ?range ?is ?preserved (i.e., when next >> ? ? ? ? ? ? ? accessed, the same content will be visible, ?but >> ? ? ? ? ? ? ? in ?a new physical page frame), and the original >> ? ? ? ? ? ? ? page is offlined ?(i.e., ?no ?longer ?used, ?and >> ? ? ? ? ? ? ? taken ?out ?of ?normal ?memory management). ?The >> ? ? ? ? ? ? ? effect of ?the ?MADV_SOFT_OFFLINE ?operation ?is >> ? ? ? ? ? ? ? invisible ?to ?(i.e., does not change the seman- >> ? ? ? ? ? ? ? tics of) the calling process. ... >> >> The actual patch for man-pages-3.26 is below. > > Thanks. The change looks good to me. Thanks for checking it. > Note that the other perceivable change may be a little access delay. > The kernel could choose to simply drop the in-memory data when there > is another copy in disk. When accessed again, the content for the new > physical page will be populated from disk IO. Yes, I'd suposed as much, but decided that was a detail that probably didm\t need to be mentioned in tha man page. Thanks, Michael >> >> --- a/man2/madvise.2 >> +++ b/man2/madvise.2 >> @@ -163,12 +163,14 @@ Soft offline the pages in the range specified by >> ?.I addr >> ?and >> ?.IR length . >> -The memory of each page in the specified range is copied to a new page, >> +The memory of each page in the specified range is preserved >> +(i.e., when next accessed, the same content will be visible, >> +but in a new physical page frame), >> ?and the original page is offlined >> ?(i.e., no longer used, and taken out of normal memory management). >> ?The effect of the >> ?.B MADV_SOFT_OFFLINE >> -operation is normally invisible to (i.e., does not change the semantics of) >> +operation is invisible to (i.e., does not change the semantics of) >> ?the calling process. >> ?This feature is intended for testing of memory error-handling code; >> ?it is only available if the kernel was configured with > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Author of "The Linux Programming Interface" http://blog.man7.org/ -- 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/