From patchwork Tue Jul 19 22:00:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9238381 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6FA31600CB for ; Tue, 19 Jul 2016 22:04:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DEBD1FF15 for ; Tue, 19 Jul 2016 22:04:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D4502787C; Tue, 19 Jul 2016 22:04:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C45571FF15 for ; Tue, 19 Jul 2016 22:04:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bPd4B-000523-DS; Tue, 19 Jul 2016 22:00:39 +0000 Received: from mail-yw0-f179.google.com ([209.85.161.179]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bPd47-0004zT-NQ for linux-arm-kernel@lists.infradead.org; Tue, 19 Jul 2016 22:00:36 +0000 Received: by mail-yw0-f179.google.com with SMTP id r9so29303002ywg.0 for ; Tue, 19 Jul 2016 15:00:15 -0700 (PDT) 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:in-reply-to; bh=4XVOUwKaSIHtAjCU3TJ1SjNtxQJInnRBHgSAjfvWM1Y=; b=iqO/ZCsDOJOrGUoiX6kGerWLXpvDR26HqfQpR3ufA+W/Ni+xY7Z+v24Rwr4GzpHLHn xr5UMT9szSfg++b7LwQJQAmduNXffzFsR6ne4mOW7JTS0zcS68oIAByQmoMdGGNoC8Sq yKF4IR+zAyxi39VmyBpk69A1FUPkHow2/+XBpTjFAQ+8DRdct8UE0u6Y6ERNUr59ti2F WALPsuNGzwuSoIrO/DZLjIwTGp2kbRa0Jfj34yki1Ee4XSrEOdcqT59RIxnHALiEFIKS kTHNMu0rGsDChq6Uuw1j4cme2BuTJ203eW0i5jRyZcVHF+jq8vdBs58kQeFwGuBzkONt MMeQ== X-Gm-Message-State: ALyK8tIzn3O+6uWr+B7+dCfBsTwNj6GFIsOVD8bzkVpuWdCBg1YXRJtwiJQpT1GcB+18ZEmn X-Received: by 10.13.222.133 with SMTP id h127mr18263370ywe.211.1468965614545; Tue, 19 Jul 2016 15:00:14 -0700 (PDT) Received: from labbott-redhat-machine.redhat.com ([2601:602:9800:177f::337f]) by smtp.gmail.com with ESMTPSA id z188sm1259998ywg.46.2016.07.19.15.00.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Jul 2016 15:00:13 -0700 (PDT) From: Laura Abbott To: linux-kernel@vger.kernel.org Subject: [PATCH] mm: Add is_migrate_cma_page Date: Tue, 19 Jul 2016 15:00:04 -0700 Message-Id: <1468965604-25023-1-git-send-email-labbott@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160719_150035_852427_80FCE360 X-CRM114-Status: GOOD ( 10.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jan Kara , kernel-hardening@lists.openwall.com, Catalin Marinas , Will Deacon , linux-mm@kvack.org, sparclinux@vger.kernel.org, linux-ia64@vger.kernel.org, Christoph Lameter , Andrea Arcangeli , linux-arch@vger.kernel.org, Michael Ellerman , x86@kernel.org, Russell King , Borislav Petkov , Benjamin Herrenschmidt , PaX Team , Laura Abbott , Mathias Krause , Fenghua Yu , Rik van Riel , Kees Cook , Vitaly Wool , David Rientjes , Tony Luck , Andy Lutomirski , Joonsoo Kim , Dmitry Vyukov , Laura Abbott , linux-arm-kernel@lists.infradead.org, Brad Spengler , Ard Biesheuvel , Pekka Enberg , Casey Schaufler , Andrew Morton , linuxppc-dev@lists.ozlabs.org, "David S. Miller" MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Code such as hardened user copy[1] needs a way to tell if a page is CMA or not. Add is_migrate_cma_page in a similar way to is_migrate_isolate_page. [1]http://article.gmane.org/gmane.linux.kernel.mm/155238 Signed-off-by: Laura Abbott --- Here's an explicit patch, slightly different than what I posted before. It can be kept separate or folded in as needed. --- include/linux/mmzone.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 02069c2..c8478b2 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -68,8 +68,10 @@ extern char * const migratetype_names[MIGRATE_TYPES]; #ifdef CONFIG_CMA # define is_migrate_cma(migratetype) unlikely((migratetype) == MIGRATE_CMA) +# define is_migrate_cma_page(_page) (get_pageblock_migratetype(_page) == MIGRATE_CMA) #else # define is_migrate_cma(migratetype) false +# define is_migrate_cma_page(_page) false #endif #define for_each_migratetype_order(order, type) \