From patchwork Tue Jun 11 01:12:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 17752 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f199.google.com (mail-qc0-f199.google.com [209.85.216.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 59B7725DF9 for ; Tue, 11 Jun 2013 01:12:55 +0000 (UTC) Received: by mail-qc0-f199.google.com with SMTP id a1sf3981373qcx.6 for ; Mon, 10 Jun 2013 18:12:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=Qg4ZoF6lC99XsCBAzmkelez46OhJ6bP/MXwxbiZyWQw=; b=YVkphtxsiS44BVfA5L8DcHonxsJ8Ep4CH+XNO8cu61nDQmwiqsaJJV0/P9+Ndpuxh7 EZBM5Hsc8hfV8mRSnthMfUQwZoI6HGxg+k9A1m0lOqZZNWFjbptXGjpiaeC0zjRYSF4e Vc7FLQu3c5wgIOmYzGEvIWqY8jTTht5p7ds471t4H+leBA1Ar9bBrefbbN5Q1BsAD39R 6rr4DHVAxHKwzZ36fNMVMc80ItoyQwISzIrHNtEdWKOOiay2W4EOBjzKSOEjWuRrRJWW /D9Um5gBPXQDHnPbQT6igSVVqzQWBJvQNZcpB+KjIm2s3K9uRrMg8VUGk7KMsZuQy2ba zmmQ== X-Received: by 10.224.59.205 with SMTP id m13mr9717878qah.7.1370913175043; Mon, 10 Jun 2013 18:12:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.97.136 with SMTP id ea8ls1152586qeb.43.gmail; Mon, 10 Jun 2013 18:12:54 -0700 (PDT) X-Received: by 10.52.35.133 with SMTP id h5mr6199135vdj.109.1370913174831; Mon, 10 Jun 2013 18:12:54 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id cf3si6135808vcb.72.2013.06.10.18.12.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Jun 2013 18:12:54 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.176 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.176; Received: by mail-vc0-f176.google.com with SMTP id ha12so1459961vcb.35 for ; Mon, 10 Jun 2013 18:12:54 -0700 (PDT) X-Received: by 10.52.157.138 with SMTP id wm10mr6106059vdb.57.1370913174711; Mon, 10 Jun 2013 18:12:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.10.206 with SMTP id pb14csp89604vcb; Mon, 10 Jun 2013 18:12:54 -0700 (PDT) X-Received: by 10.66.150.40 with SMTP id uf8mr16517522pab.66.1370913173810; Mon, 10 Jun 2013 18:12:53 -0700 (PDT) Received: from mail-pa0-x236.google.com (mail-pa0-x236.google.com [2607:f8b0:400e:c03::236]) by mx.google.com with ESMTPS id ez5si2684420pab.19.2013.06.10.18.12.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Jun 2013 18:12:53 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400e:c03::236 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=2607:f8b0:400e:c03::236; Received: by mail-pa0-f54.google.com with SMTP id kx10so2654203pab.27 for ; Mon, 10 Jun 2013 18:12:53 -0700 (PDT) X-Received: by 10.66.91.107 with SMTP id cd11mr16232508pab.74.1370913173408; Mon, 10 Jun 2013 18:12:53 -0700 (PDT) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id qe10sm9802489pbb.2.2013.06.10.18.12.52 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Jun 2013 18:12:52 -0700 (PDT) From: John Stultz To: minchan@kernel.org Cc: dgiani@mozilla.com, John Stultz Subject: [PATCH 06/13] vrange: Add GFP_NO_VRANGE allocation flag Date: Mon, 10 Jun 2013 18:12:12 -0700 Message-Id: <1370913139-9320-7-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1370913139-9320-1-git-send-email-john.stultz@linaro.org> References: <1370913139-9320-1-git-send-email-john.stultz@linaro.org> X-Gm-Message-State: ALoCoQl5bLuUjjtgEC9oFBfe7gznWp623sojPDKptnFPToh6Se2VVU9K0hCnXxf/4twkG/QmIVYq X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.176 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Minchan Kim In cloning the vroot tree during a fork, we have to allocate memory while hold the vroot lock. This is problematic, as the memory allocation can trigger reclaim, which might require grabbing a vroot lock in order to find purgable pages. Thus this patch introduces GFP_NO_VRANGE which will allow us to avoid having a allocation for vrange to trigger any volatile range purging. Signed-off-by: Minchan Kim --- include/linux/gfp.h | 7 +++++-- mm/vrange.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 0f615eb..fa52199 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -35,6 +35,7 @@ struct vm_area_struct; #define ___GFP_NO_KSWAPD 0x400000u #define ___GFP_OTHER_NODE 0x800000u #define ___GFP_WRITE 0x1000000u +#define ___GFP_NO_VRANGE 0x2000000u /* If the above are modified, __GFP_BITS_SHIFT may need updating */ /* @@ -70,6 +71,7 @@ struct vm_area_struct; #define __GFP_HIGH ((__force gfp_t)___GFP_HIGH) /* Should access emergency pools? */ #define __GFP_IO ((__force gfp_t)___GFP_IO) /* Can start physical IO? */ #define __GFP_FS ((__force gfp_t)___GFP_FS) /* Can call down to low-level FS? */ +#define __GFP_NO_VRANGE ((__force gfp_t)___GFP_NO_VRANGE) /* Can't reclaim volatile pages */ #define __GFP_COLD ((__force gfp_t)___GFP_COLD) /* Cache-cold page required */ #define __GFP_NOWARN ((__force gfp_t)___GFP_NOWARN) /* Suppress page allocation failure warning */ #define __GFP_REPEAT ((__force gfp_t)___GFP_REPEAT) /* See above */ @@ -99,7 +101,7 @@ struct vm_area_struct; */ #define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK) -#define __GFP_BITS_SHIFT 25 /* Room for N __GFP_FOO bits */ +#define __GFP_BITS_SHIFT 26 /* Room for N __GFP_FOO bits */ #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) /* This equals 0, but use constants in case they ever change */ @@ -134,7 +136,8 @@ struct vm_area_struct; /* Control page allocator reclaim behavior */ #define GFP_RECLAIM_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS|\ __GFP_NOWARN|__GFP_REPEAT|__GFP_NOFAIL|\ - __GFP_NORETRY|__GFP_MEMALLOC|__GFP_NOMEMALLOC) + __GFP_NORETRY|__GFP_MEMALLOC|__GFP_NOMEMALLOC|\ + __GFP_NO_VRANGE) /* Control slab gfp mask during early boot */ #define GFP_BOOT_MASK (__GFP_BITS_MASK & ~(__GFP_WAIT|__GFP_IO|__GFP_FS)) diff --git a/mm/vrange.c b/mm/vrange.c index 0ab741e..914c109 100644 --- a/mm/vrange.c +++ b/mm/vrange.c @@ -204,7 +204,7 @@ int vrange_fork(struct mm_struct *new_mm, struct mm_struct *old_mm) range = vrange_entry(next); next = rb_next(next); - new_range = __vrange_alloc(GFP_KERNEL); + new_range = __vrange_alloc(GFP_KERNEL|__GFP_NO_VRANGE); if (!new_range) goto fail; __vrange_set(new_range, range->node.start,