Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6336799ybi; Tue, 4 Jun 2019 23:04:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwM4g33ajoy1HqaVR/pQmPKp7W9lyZtbNaCvgHAbE9r+5maViDA5a8uK6aT7/Q4VxgtJFLf X-Received: by 2002:a17:90a:23ce:: with SMTP id g72mr35650213pje.77.1559714650745; Tue, 04 Jun 2019 23:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559714650; cv=none; d=google.com; s=arc-20160816; b=FdfGqIeNW0hjdHfIZDseTLIW3RDQ3U4eT6P/wnkk6/e9puZKIMHK/q8bm0Wb8L8RLU yI3SM1mecff65lZ/Okj1gMMk8demNWF2dGrf814eEgWIxd+qtysfJZidNs9r0GCZr5MV PdK2az8PJ+WoN4cTN4QSWCnpAdM74pse9OzxJsjXdE6AybLLrWPs5NCr5Jvf13xkUkzT b8W37dQd5qx4pUdNdDc0eWDlws/msoNjl8v21tSnYRrC/7+qpJAD0Bmmy7D6J96Fjm0E OYSSo3KAcuya4FrwOm/houvCD1KgbxiQ3sW4lvHcHzGFXu+scYnTc8HeRbd2V19FUclD TwUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=+mL4FgQ19EroXhijChjGHOiTYmNvNkGMP7gXP3vKz00=; b=x6OKLou4yAtokl5IUOj8l7Rqx8BW7HgBSSfSRo8JnY2UAsKgvMtTTd4f7edX3qVbLK P/bl1+OdXQdzQqCI5S//b80pdvRtdKajTyWBeJL+8jXm8Uxki81Mg2vTLf7Z3NNlYeBH 2DCWwrOr8fOg0Hfl8fbQoqWnBZ5WGLS/l15fU9xFQQztFLKlVQXjgoXfWiOnx4wIolsO uQhtMUoo0FVHNmH7gnsADWKfNcfraRNucTC0z6mCoGaOm3WOilTBLYBPGJluM61jh0Hn OMByUNmSTTNO4U9jUisP/JEsx873YpkVEXaiqyc16eru3FsTrOBgID8ytV0W9tBgjIvP LgsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=d8ZvxiH8; 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 sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i22si27377588pfd.84.2019.06.04.23.03.52; Tue, 04 Jun 2019 23:04:10 -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=@gmail.com header.s=20161025 header.b=d8ZvxiH8; 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 sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726645AbfFEGCg (ORCPT + 99 others); Wed, 5 Jun 2019 02:02:36 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:34067 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726263AbfFEGCg (ORCPT ); Wed, 5 Jun 2019 02:02:36 -0400 Received: by mail-pg1-f193.google.com with SMTP id h2so8550260pgg.1 for ; Tue, 04 Jun 2019 23:02:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=+mL4FgQ19EroXhijChjGHOiTYmNvNkGMP7gXP3vKz00=; b=d8ZvxiH89al4I/4f5vPjsl6RJCAYuBwyr5JZ86FJPZePkQ9Ev2NOSlwuv3X66y/Z4D q/B05M4hwLcOu9pDU6heJbhMtQvWUr/2vdCxtp0DhHcfYmxse5+gHlic6msQL3HiA67c beApp4NKO1NfGHj+p2P+yLS8IVF3dHavOE2fPO8TuwbbdCzanev+M2ehx/kiTWjgDbGS c2zxtr9M8BPnA4tzU81hgiHhp6oquEpttG7B3NxRng1Vwz1NZK77vTKlPhMsgFTKEoWC +9ma7/4q7NrrIhyY2pJ+E+zgExMUrRzbJnrOhorpSulak1udo/aReyAYc8MsXpr1AtQ6 3oJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=+mL4FgQ19EroXhijChjGHOiTYmNvNkGMP7gXP3vKz00=; b=l4b0ARbzjYDYfn49pGvCzV+EtonLf4r2UT6eS+m0w1pGGfG+ZyBul6HQqPHUYo6f3U xl38WF5yPFIdhofxXQdQ3jnYzKFZEBFErl1va92/FQFajI7m15HFHvxzjMlMDqMpXEIs irdwenqE0e24j8wOduNOPKaSmOfa+HeeB0RjKUWWaNnTBU50qAFYhXpY6iQr9unMf2ga Cj3oV9VPE+M2IVCbigXx8gRzWRpFQXdE1Okse9nvI94+2169WTE1n8gIVoKuJvlBklsh T/X+kjnL0Fs90E28HYgCmJW8EZw8VqSGPcAzeSra+bLcvsdXRyReQP22oEDhpyK5H2dJ n2fA== X-Gm-Message-State: APjAAAVX5iR2ru7IRrlOHoB4RYnLcv7TTbSNYRmO16Cme5+gVEmkivhx 1hUN2ZLlKF59Hi4XzlCPT3Y= X-Received: by 2002:a63:fe51:: with SMTP id x17mr2094853pgj.339.1559714556080; Tue, 04 Jun 2019 23:02:36 -0700 (PDT) Received: from bharath12345-Inspiron-5559 ([103.110.42.36]) by smtp.gmail.com with ESMTPSA id u184sm871872pfb.32.2019.06.04.23.02.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jun 2019 23:02:35 -0700 (PDT) Date: Wed, 5 Jun 2019 11:32:29 +0530 From: Bharath Vedartham To: akpm@linux-foundation.org, vbabka@suse.cz, mhocko@suse.com, rientjes@google.com Cc: khalid.aziz@oracle.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm: Remove VM_BUG_ON in __alloc_pages_node Message-ID: <20190605060229.GA9468@bharath12345-Inspiron-5559> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In __alloc_pages_node, there is a VM_BUG_ON on the condition (nid < 0 || nid >= MAX_NUMNODES). Remove this VM_BUG_ON and add a VM_WARN_ON, if the condition fails and fail the allocation if an invalid NUMA node id is passed to __alloc_pages_node. The check (nid < 0 || nid >= MAX_NUMNODES) also considers NUMA_NO_NODE as an invalid nid, but the caller of __alloc_pages_node is assumed to have checked for the case where nid == NUMA_NO_NODE. Signed-off-by: Bharath Vedartham --- include/linux/gfp.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 5f5e25f..075bdaf 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -480,7 +480,11 @@ __alloc_pages(gfp_t gfp_mask, unsigned int order, int preferred_nid) static inline struct page * __alloc_pages_node(int nid, gfp_t gfp_mask, unsigned int order) { - VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES); + if (nid < 0 || nid >= MAX_NUMNODES) { + VM_WARN_ON(nid < 0 || nid >= MAX_NUMNODES); + return NULL; + } + VM_WARN_ON((gfp_mask & __GFP_THISNODE) && !node_online(nid)); return __alloc_pages(gfp_mask, order, nid); -- 2.7.4