From patchwork Wed May 4 17:01:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 67164 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp311540qge; Wed, 4 May 2016 10:28:15 -0700 (PDT) X-Received: by 10.67.22.168 with SMTP id ht8mr13780977pad.50.1462382895550; Wed, 04 May 2016 10:28:15 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k28si5742924pfk.240.2016.05.04.10.28.15; Wed, 04 May 2016 10:28:15 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754796AbcEDR2N (ORCPT + 29 others); Wed, 4 May 2016 13:28:13 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:33809 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753596AbcEDR2M (ORCPT ); Wed, 4 May 2016 13:28:12 -0400 Received: by mail-pa0-f49.google.com with SMTP id r5so27103506pag.1 for ; Wed, 04 May 2016 10:28:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=/1sRHelH9QPrr+posntOZqQ7Jav4XwGQbsAFYo5asnM=; b=R3jI8/JLtRlMyXB3mlYcZ53cto7Lg0fPZNLdm0vYNarUGjeJqXK9Ji9iUy4RpxqcWc lEiNa7c+ScvFj4e06Eehv4LPdh65ZnGI6GfwKStMfAIsrEldf7l+CS8DzW0rcr3XJj6y DwlihYtef0+V5dK9UVDpZh9klyEKe4Mye31hE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/1sRHelH9QPrr+posntOZqQ7Jav4XwGQbsAFYo5asnM=; b=NxoUVC5rJt3drRCRxC9nlIduddkdj7OTozmttqJ64PVuL22JF4StoDZTJP9873akvY o0ONp9bFupgmdZ1Iv2M22EZIFXZY9UqaxtET2KI37cVcYnpaSEkzJRJA4nUkRezzQ8e0 SMASLF0UuJ3gNMQqAms0745hYJtxEGqQFy1YlU+C+QG4NnzLIFmi7KFI2VphS1h8k8/B AZqEI7EtEWCz5SP5Do1Np3kPLXBlsZzIgvOSQeJUF3JN5h0McpJke6+AUzleAPaAlz32 4e0lQtWtmCgvDYK/FmCDFb+okW2xsP9U6myuamKA0Wp8/7vabtF+JlRCigvYV5TGSnRH C+Lg== X-Gm-Message-State: AOPr4FUbJnkFSMpMYVFz27zashEBPym10qVLXCAjuI/qml6A3xbygJgnucC4wnze260449ne X-Received: by 10.66.132.103 with SMTP id ot7mr13822837pab.27.1462382891366; Wed, 04 May 2016 10:28:11 -0700 (PDT) Received: from yshi-Precision-T5600.corp.ad.wrs.com (unknown-216-82.windriver.com. [147.11.216.82]) by smtp.gmail.com with ESMTPSA id ey12sm7524282pac.26.2016.05.04.10.28.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 May 2016 10:28:10 -0700 (PDT) From: Yang Shi To: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, hannes@cmpxchg.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linaro-kernel@lists.linaro.org, yang.shi@linaro.org Subject: [PATCH] mm: slab: remove ZONE_DMA_FLAG Date: Wed, 4 May 2016 10:01:37 -0700 Message-Id: <1462381297-11009-1-git-send-email-yang.shi@linaro.org> X-Mailer: git-send-email 2.0.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now we have IS_ENABLED helper to check if a Kconfig option is enabled or not, so ZONE_DMA_FLAG sounds no longer useful. And, the use of ZONE_DMA_FLAG in slab looks pointless according to the comment [1] from Johannes Weiner, so remove them and ORing passed in flags with the cache gfp flags has been done in kmem_getpages(). [1] https://lkml.org/lkml/2014/9/25/553 Signed-off-by: Yang Shi --- Found the problem when I was reading the slab code for investigating another issue, and found a similar fix has been sent to review in 2014, but it didn't get merged into upstream. Rework the patch to adopt the comment from Johannes Weiner. mm/Kconfig | 5 ----- mm/slab.c | 24 +----------------------- 2 files changed, 1 insertion(+), 28 deletions(-) -- 2.0.2 diff --git a/mm/Kconfig b/mm/Kconfig index 989f8f3..d6e9042 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -268,11 +268,6 @@ config ARCH_ENABLE_HUGEPAGE_MIGRATION config PHYS_ADDR_T_64BIT def_bool 64BIT || ARCH_PHYS_ADDR_T_64BIT -config ZONE_DMA_FLAG - int - default "0" if !ZONE_DMA - default "1" - config BOUNCE bool "Enable bounce buffers" default y diff --git a/mm/slab.c b/mm/slab.c index 17e2848..3bcae12 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2138,7 +2138,7 @@ done: cachep->freelist_size = cachep->num * sizeof(freelist_idx_t); cachep->flags = flags; cachep->allocflags = __GFP_COMP; - if (CONFIG_ZONE_DMA_FLAG && (flags & SLAB_CACHE_DMA)) + if (flags & SLAB_CACHE_DMA) cachep->allocflags |= GFP_DMA; cachep->size = size; cachep->reciprocal_buffer_size = reciprocal_value(size); @@ -2438,16 +2438,6 @@ static void cache_init_objs(struct kmem_cache *cachep, } } -static void kmem_flagcheck(struct kmem_cache *cachep, gfp_t flags) -{ - if (CONFIG_ZONE_DMA_FLAG) { - if (flags & GFP_DMA) - BUG_ON(!(cachep->allocflags & GFP_DMA)); - else - BUG_ON(cachep->allocflags & GFP_DMA); - } -} - static void *slab_get_obj(struct kmem_cache *cachep, struct page *page) { void *objp; @@ -2538,14 +2528,6 @@ static int cache_grow(struct kmem_cache *cachep, local_irq_enable(); /* - * The test for missing atomic flag is performed here, rather than - * the more obvious place, simply to reduce the critical path length - * in kmem_cache_alloc(). If a caller is seriously mis-behaving they - * will eventually be caught here (where it matters). - */ - kmem_flagcheck(cachep, flags); - - /* * Get mem for the objs. Attempt to allocate a physical page from * 'nodeid'. */ @@ -2884,9 +2866,6 @@ static inline void cache_alloc_debugcheck_before(struct kmem_cache *cachep, gfp_t flags) { might_sleep_if(gfpflags_allow_blocking(flags)); -#if DEBUG - kmem_flagcheck(cachep, flags); -#endif } #if DEBUG @@ -3044,7 +3023,6 @@ retry: if (gfpflags_allow_blocking(local_flags)) local_irq_enable(); - kmem_flagcheck(cache, flags); page = kmem_getpages(cache, local_flags, numa_mem_id()); if (gfpflags_allow_blocking(local_flags)) local_irq_disable();