Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3431607pxb; Mon, 1 Nov 2021 13:43:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKVyUNgzCGjptPGdI3ewDc04OfbNp5EWvtasvr7kSc5a6PrFA5EH1g5d44MVz1YRcTtuIa X-Received: by 2002:a17:906:e85:: with SMTP id p5mr39761376ejf.159.1635799402505; Mon, 01 Nov 2021 13:43:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635799402; cv=none; d=google.com; s=arc-20160816; b=SLMKr70rTjrZgOAm7zPvIL5NQ6a9Xz8ozcKJifJXAFLwl5n/lDls8jfkJiuw18NBrV Nu9HMCABHB1RjRipLDhGqdgtMVO6uXMEMNFYZtXqnj4nqefz+J8SQArtCrlTurQU2Cgq TrbsIyTyX577Mg6li9cj0PEb1IHdmCQ5BzF1Dr6OkPE+phJ95uoTmJGFahnH4vLoyhtG 6Eo7HdoX7Cz4WJ8eOg8oYnA/bI/Oeru4JT2UaZmWSnioht62Aa3bqFUbpf7De6Jefd7j LZbcGpNNfxBHmrEkvpcyLqx2EFlxSESHpee4tYTGhfAXe1gePWl3NQUam3PObKaD7g/s oEvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=GDo38ocU3pLClKl3wyVO90VvxmLoO3CeEoE5GEzkERk=; b=LvCczqiJpI827VwKIkZEGQfL8a6rVBZI0N5pojahO5P/nhr38fTdyDR1al+appnbH/ JRMrHTkno/brbiHJDhxExupDAn6dxULUKi3uDXBWwyvh7FBJr1Dg2C2tlAoskVcvfv1R Uf/TQI7ZxY1OdLqQbmRoRVMYstACDhuxqdbMktYsnOhpHNfM14xM6aBlgaAuOOiTt1zF lfhs6+2mBWZJyQeUxRfy2prTZCfEBEOJQnRNq+cHCxprQDqH1jq6VR2SUV6I9tGvLpMb ZdKaC1XBhZhV8yCA0NryqVEc5YKn41zk/TlHevpJfKT512RNEQimQkXh8iyHde7LvKUP Ff1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=RyJbRA3f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hs31si18927661ejc.549.2021.11.01.13.42.53; Mon, 01 Nov 2021 13:43:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=RyJbRA3f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229966AbhKAUn0 (ORCPT + 99 others); Mon, 1 Nov 2021 16:43:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230333AbhKAUnA (ORCPT ); Mon, 1 Nov 2021 16:43:00 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9114AC061714; Mon, 1 Nov 2021 13:40:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=GDo38ocU3pLClKl3wyVO90VvxmLoO3CeEoE5GEzkERk=; b=RyJbRA3f+AsVJo0k56Bz2l/1Sy hrFjNtQEliiW2GQnf+kHW3bKSW85yzuT9LHZ52az81pke0WekzAxASXhQ7RlasjSXl+KkXHnDebAS U02xF4K1cDk5Mdc360fo498yuNvtnmtzMKihBll2bFbQXlzvFRLleNsjipEu1a7NascW/LH5i7e2o 0y/dPIhJkV2bfvriOV9Eu+d3U6Wa3Lq5ynVnq1lZgG7hNEAqRAlWF3E+bY6n/GPyRueE0eLm8elg6 7pjQJQerALpUp2VCDs9kGix/k56KtzlMH4+hwsFkz4A5r7MOsqNjThluY4iO8HmgTxNBrjZF1ktlO /hdgGrkw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mhe4Q-0040Ih-AQ; Mon, 01 Nov 2021 20:38:45 +0000 Date: Mon, 1 Nov 2021 20:38:18 +0000 From: Matthew Wilcox To: Alexey Makhalov Cc: linux-mm@kvack.org, Andrew Morton , linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] mm: fix panic in __alloc_pages Message-ID: References: <20211101201312.11589-1-amakhalov@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211101201312.11589-1-amakhalov@vmware.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 01, 2021 at 01:13:12PM -0700, Alexey Makhalov wrote: > +++ b/include/linux/gfp.h > @@ -551,7 +551,8 @@ alloc_pages_bulk_array(gfp_t gfp, unsigned long nr_pages, struct page **page_arr > static inline unsigned long > alloc_pages_bulk_array_node(gfp_t gfp, int nid, unsigned long nr_pages, struct page **page_array) > { > - if (nid == NUMA_NO_NODE) > + if (nid == NUMA_NO_NODE || (!node_online(nid) && > + !(gfp & __GFP_THISNODE))) > nid = numa_mem_id(); > > return __alloc_pages_bulk(gfp, nid, NULL, nr_pages, NULL, page_array); I don't think it's a great idea to push node_online() and the gfp check into the caller. Can't we put this check in __alloc_pages_bulk() instead?