From patchwork Mon Apr 7 18:37:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 27921 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f200.google.com (mail-yk0-f200.google.com [209.85.160.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4B90D20490 for ; Mon, 7 Apr 2014 18:38:16 +0000 (UTC) Received: by mail-yk0-f200.google.com with SMTP id q9sf14563194ykb.11 for ; Mon, 07 Apr 2014 11:38:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type:content-transfer-encoding; bh=47hsHtuJq3dVJ0686LjpzzAyivjn23KutmF6519GmVQ=; b=jXRZdyJ5Kqii+ORdGOkxhxJhFJgdb+nnILI31orWhtysDoM+rFsZfVzod2BAmiizFE JyXdWoQ2+AV5YXlCf1V+gEp4pydqJAOwbxctJ2GLkps/YL4+BKulAV2VOxUTX3FCNJF7 0Y0EYF7iBeUIPPcJpcdQz1kPR5RYjPcrnk/hmDvJs2XDerojWjyThHtD5XPuPomA1mUl AVfxatpRu3mTK6aPkEDOV1d6B7+2l6j+eorPp/vlqqvDTmdbr+kYA6hqncUtxKJkooj3 MW2qPA/N5QC3GyVQ0jdx9JUW7dA7CflIcp+yjTGk61/PtnBuJzaV0D+ilsQ4lF6mUBLo aPJw== X-Gm-Message-State: ALoCoQnK/B0ctbjq28o2qynMync4GMrtMenX9tlXp3i5dfL66fnXO7MCzZy3R+h8gN/j2FSB7aTj X-Received: by 10.236.125.6 with SMTP id y6mr15357213yhh.3.1396895896235; Mon, 07 Apr 2014 11:38:16 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.82.16 with SMTP id g16ls1832713qgd.25.gmail; Mon, 07 Apr 2014 11:38:16 -0700 (PDT) X-Received: by 10.52.15.132 with SMTP id x4mr1795247vdc.31.1396895896121; Mon, 07 Apr 2014 11:38:16 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id cb3si3280065vdc.113.2014.04.07.11.38.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 07 Apr 2014 11:38:16 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id ij19so5665972vcb.38 for ; Mon, 07 Apr 2014 11:38:16 -0700 (PDT) X-Received: by 10.220.81.194 with SMTP id y2mr1614009vck.29.1396895896019; Mon, 07 Apr 2014 11:38:16 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.12.8 with SMTP id v8csp185358vcv; Mon, 7 Apr 2014 11:38:15 -0700 (PDT) X-Received: by 10.68.237.133 with SMTP id vc5mr32781851pbc.92.1396895893907; Mon, 07 Apr 2014 11:38:13 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vn9si8772856pbc.260.2014.04.07.11.38.13; Mon, 07 Apr 2014 11:38:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755665AbaDGSiB (ORCPT + 27 others); Mon, 7 Apr 2014 14:38:01 -0400 Received: from mail-pb0-f42.google.com ([209.85.160.42]:33298 "EHLO mail-pb0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753281AbaDGSh7 (ORCPT ); Mon, 7 Apr 2014 14:37:59 -0400 Received: by mail-pb0-f42.google.com with SMTP id rr13so7137781pbb.15 for ; Mon, 07 Apr 2014 11:37:58 -0700 (PDT) X-Received: by 10.67.5.7 with SMTP id ci7mr9942390pad.99.1396895878469; Mon, 07 Apr 2014 11:37:58 -0700 (PDT) Received: from [192.168.122.27] (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id et3sm38342420pbc.52.2014.04.07.11.37.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 07 Apr 2014 11:37:57 -0700 (PDT) Message-ID: <5342F083.5020509@linaro.org> Date: Mon, 07 Apr 2014 11:37:55 -0700 From: John Stultz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: KOSAKI Motohiro CC: LKML , Andrew Morton , Android Kernel Team , Johannes Weiner , Robert Love , Mel Gorman , Hugh Dickins , Dave Hansen , Rik van Riel , Dmitry Adamushko , Neil Brown , Andrea Arcangeli , Mike Hommey , Taras Glek , Jan Kara , Michel Lespinasse , Minchan Kim , "linux-mm@kvack.org" Subject: Re: [PATCH 2/5] vrange: Add purged page detection on setting memory non-volatile References: <1395436655-21670-1-git-send-email-john.stultz@linaro.org> <1395436655-21670-3-git-send-email-john.stultz@linaro.org> In-Reply-To: X-Enigmail-Version: 1.6 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.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.220.179 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 Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On 03/23/2014 10:42 AM, KOSAKI Motohiro wrote: > On Fri, Mar 21, 2014 at 2:17 PM, John Stultz wrote: >> Users of volatile ranges will need to know if memory was discarded. >> This patch adds the purged state tracking required to inform userland >> when it marks memory as non-volatile that some memory in that range >> was purged and needs to be regenerated. >> >> This simplified implementation which uses some of the logic from >> Minchan's earlier efforts, so credit to Minchan for his work. >> >> Cc: Andrew Morton >> Cc: Android Kernel Team >> Cc: Johannes Weiner >> Cc: Robert Love >> Cc: Mel Gorman >> Cc: Hugh Dickins >> Cc: Dave Hansen >> Cc: Rik van Riel >> Cc: Dmitry Adamushko >> Cc: Neil Brown >> Cc: Andrea Arcangeli >> Cc: Mike Hommey >> Cc: Taras Glek >> Cc: Jan Kara >> Cc: KOSAKI Motohiro >> Cc: Michel Lespinasse >> Cc: Minchan Kim >> Cc: linux-mm@kvack.org >> Signed-off-by: John Stultz >> --- >> include/linux/swap.h | 15 ++++++++-- >> include/linux/swapops.h | 10 +++++++ >> include/linux/vrange.h | 3 ++ >> mm/vrange.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ >> 4 files changed, 101 insertions(+), 2 deletions(-) >> >> diff --git a/include/linux/swap.h b/include/linux/swap.h >> index 46ba0c6..18c12f9 100644 >> --- a/include/linux/swap.h >> +++ b/include/linux/swap.h >> @@ -70,8 +70,19 @@ static inline int current_is_kswapd(void) >> #define SWP_HWPOISON_NUM 0 >> #endif >> >> -#define MAX_SWAPFILES \ >> - ((1 << MAX_SWAPFILES_SHIFT) - SWP_MIGRATION_NUM - SWP_HWPOISON_NUM) >> + >> +/* >> + * Purged volatile range pages >> + */ >> +#define SWP_VRANGE_PURGED_NUM 1 >> +#define SWP_VRANGE_PURGED (MAX_SWAPFILES + SWP_HWPOISON_NUM + SWP_MIGRATION_NUM) >> + >> + >> +#define MAX_SWAPFILES ((1 << MAX_SWAPFILES_SHIFT) \ >> + - SWP_MIGRATION_NUM \ >> + - SWP_HWPOISON_NUM \ >> + - SWP_VRANGE_PURGED_NUM \ >> + ) > This change hwpoison and migration tag number. maybe ok, maybe not. Though depending on config can't these tag numbers change anyway? > I'd suggest to use younger number than hwpoison. > (That's why hwpoison uses younger number than migration) So I can, but the way these are defined makes the results seem pretty terrible: #define SWP_MIGRATION_WRITE (MAX_SWAPFILES + SWP_HWPOISON_NUM \ + SWP_MVOLATILE_PURGED_NUM + 1) Particularly when: #define MAX_SWAPFILES ((1 << MAX_SWAPFILES_SHIFT) \ - SWP_MIGRATION_NUM \ - SWP_HWPOISON_NUM \ - SWP_MVOLATILE_PURGED_NUM \ ) Its a lot of unnecessary mental gymnastics. Yuck. Would a general cleanup like the following be ok to try to make this more extensible? thanks -john --- 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/ diff --git a/include/linux/swap.h b/include/linux/swap.h index 3507115..21387df 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -49,29 +49,38 @@ static inline int current_is_kswapd(void) * actions on faults. */ +enum { + /* + * NOTE: We use the high bits here (subtracting from + * 1<