From patchwork Fri Jun 22 16:28:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 10482683 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 DC7C46023A for ; Fri, 22 Jun 2018 16:28:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED6BB28AA1 for ; Fri, 22 Jun 2018 16:28:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E264B289AB; Fri, 22 Jun 2018 16:28:51 +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=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C583288DA for ; Fri, 22 Jun 2018 16:28:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 79C726B0006; Fri, 22 Jun 2018 12:28:50 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 74C3C6B0008; Fri, 22 Jun 2018 12:28:50 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 662756B000C; Fri, 22 Jun 2018 12:28:50 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr0-f200.google.com (mail-wr0-f200.google.com [209.85.128.200]) by kanga.kvack.org (Postfix) with ESMTP id 0CF746B0006 for ; Fri, 22 Jun 2018 12:28:50 -0400 (EDT) Received: by mail-wr0-f200.google.com with SMTP id j8-v6so4645908wrh.18 for ; Fri, 22 Jun 2018 09:28:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=FW1DIyGep9jzNGj98n5+2iAPwhw+YUsx3qRxJWpnxFg=; b=UU0M66Y6KTLLPpRmAN2a3Q20O3JyDMaM4+VFuFVN9zDI7DdW3WmSWH646YbpX5Efhv y+8tdlIkKwD5R9x4Ihmpi+Fyjo4te4YyO9bpgoSK5gyIxpJF58mIcMrOYeDdY7M5RY0L pJesu6Tn8bj1Xw5kqBEKLOw0XmyXB15fcnC9jVl0KBFYEEWv9AsRcytnx7NXFJ+Cj009 hTdaHtRc3N0qMsVzGrub1me2nfk05Ich+vTWGGlcwR8mJYXlXc58+5GkEkKRYd4bjdt7 nNpoHbdKZ4i2WZvoW+1SYo6y/7wBwl+BRxIyk2xytFMANkxfQSuylUnGXKSz3qpYmV69 0a5Q== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of mstsxfx@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=mstsxfx@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Gm-Message-State: APt69E1ZpNEQYpl0gKL/L7TuAntLGXUtdr42zsw4BDhwGDls6LMr9VKT dFbxRzmK4tRzm5MsiH7P3r0ExLzkVhrceJgWLoEWHM326s0+VHnQgGAy3kzJhqwNskFesMxIDB3 9z9cRjamhUBRY3TLCgs0eRuOh37HDEYVu7YromL8HUoGLJhVr7MJ6F8yVQKcJwZ6RdGyUfCh9ds lqwrflz8ahyd8G+H2hZbgYaOhL8dCvyDuO4biYJxaAsRqWj0zBEs3L2iN4Vo820kKNqX1v3TgV6 qbKff1SjUPrWNWfHp02TRBAORkoNTjylGpKAZZAAprCSKrmlEg8PKsfaOV957QfefOOYl+P6A/l Je5qIz2Vz7OxY4vEK3oV7wJXrgmwC6S9zGsb9oCeWGpf1NRjAiN4DNtjBtWtjKJ2BEq+xV3kjw= = X-Received: by 2002:a1c:8bc3:: with SMTP id n186-v6mr2168770wmd.34.1529684929490; Fri, 22 Jun 2018 09:28:49 -0700 (PDT) X-Received: by 2002:a1c:8bc3:: with SMTP id n186-v6mr2168736wmd.34.1529684928672; Fri, 22 Jun 2018 09:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529684928; cv=none; d=google.com; s=arc-20160816; b=luYRgRZtKEXVx+5pTmOSaDXSaRlDbtvKpYOhCqXCAyjPwwTlAkbejOobsuEyVJ6ek/ PR6qNTDYdq7yaT07fXHBXF7rlxRePb0O5pEqW9kb26UIAdetn3b3xx5VcBb+qVbn+jfL yHCUkZhQq6SIGsur90JJG1/sf1jyh5+kuG+rgw6AFRXSqqAvoFryrVwb4eGCP4NqnG1l 19WLBTfgZW0L2URzLH5BXk97WOg8vVdpuy5VK2kfp0yuHZT1o4H3+zUthRvsKPsGXbYy n8PKexTi0crkNp6Exx9YI3pVHj8Yz0PeRXccnA2Ny2KakKikxCzrgJQPc1aI/H3xny1u ap0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=FW1DIyGep9jzNGj98n5+2iAPwhw+YUsx3qRxJWpnxFg=; b=TmsP78arXrtb2vzDfcZ86zmXVcskvuK12YRmcehnipnCkrF9WV8crrX54SRdj8b9eK gV2aQDRYNjuUTe1irJ5MxYmp5lffdNq68VHIlfC+fIYPrq/Mz5ghmjOpv0JZA2o2FHPP LkYk/GBKFnqZ6nNQBaRVPgCYrB0I0h6/5fLndrgqokdFYxMtKslrcYKB7fzGyZggsFtk uYCdtR7e/PEPc04HqCJQ/PF9NrBQNa685NRYQwBwO3+Whr1Caug4380e/BLOg+nDgQmo yssf0P7ibSLgWWAKQZewVo4U5XQc3xQYfSGNZHe1NdiUrHBqIep40iWl1KETaHXYMLvj Jr0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mstsxfx@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=mstsxfx@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id z12-v6sor4097331wrn.56.2018.06.22.09.28.48 for (Google Transport Security); Fri, 22 Jun 2018 09:28:48 -0700 (PDT) Received-SPF: pass (google.com: domain of mstsxfx@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mstsxfx@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=mstsxfx@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Google-Smtp-Source: AAOMgpfEQogbLwAcE8rKN7lTg7tcr7+54Cg8dHgH6UqYe/HR4itdkQQ26i83aOw7IIF8MpDspn4QYQ== X-Received: by 2002:adf:a0c2:: with SMTP id n2-v6mr2055475wrn.23.1529684928402; Fri, 22 Jun 2018 09:28:48 -0700 (PDT) Received: from tiehlicka.suse.cz (ip-37-188-179-217.eurotel.cz. [37.188.179.217]) by smtp.gmail.com with ESMTPSA id h77-v6sm3520193wmd.9.2018.06.22.09.28.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Jun 2018 09:28:47 -0700 (PDT) From: Michal Hocko To: Andrew Morton Cc: JianKang Chen , Mel Gorman , Johannes Weiner , linux-mm@kvack.org, linux-kernel@vger.kernel.org, xieyisheng1@huawei.com, guohanjun@huawei.com, wangkefeng.wang@huawei.com, Michal Hocko Subject: [PATCH] mm: drop VM_BUG_ON from __get_free_pages Date: Fri, 22 Jun 2018 18:28:41 +0200 Message-Id: <20180622162841.25114-1-mhocko@kernel.org> X-Mailer: git-send-email 2.17.1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Michal Hocko There is no real reason to blow up just because the caller doesn't know that __get_free_pages cannot return highmem pages. Simply fix that up silently. Even if we have some confused users such a fixup will not be harmful. Signed-off-by: Michal Hocko --- Hi Andrew, previously posted [1] but it fell through cracks. Can we merge it now? [1] http://lkml.kernel.org/r/20171129160446.jluzpv3n6mjc3fwv@dhcp22.suse.cz mm/page_alloc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 1521100f1e63..5f56f662a52d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4402,18 +4402,14 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred_nid, EXPORT_SYMBOL(__alloc_pages_nodemask); /* - * Common helper functions. + * Common helper functions. Never use with __GFP_HIGHMEM because the returned + * address cannot represent highmem pages. Use alloc_pages and then kmap if + * you need to access high mem. */ unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order) { struct page *page; - /* - * __get_free_pages() returns a virtual address, which cannot represent - * a highmem page - */ - VM_BUG_ON((gfp_mask & __GFP_HIGHMEM) != 0); - page = alloc_pages(gfp_mask, order); if (!page) return 0;