From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752341AbaLIUwI (ORCPT ); Tue, 9 Dec 2014 15:52:08 -0500 Received: from www.linutronix.de ([62.245.132.108]:50162 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751665AbaLIUwG (ORCPT ); Tue, 9 Dec 2014 15:52:06 -0500 Date: Tue, 9 Dec 2014 21:51:44 +0100 (CET) From: Thomas Gleixner To: Pranith Kumar cc: Ingo Molnar , "H. Peter Anvin" , "maintainer:X86 ARCHITECTURE..." , Toshi Kani , Igor Mammedov , David Rientjes , Dave Hansen , Lan Tianyu , "open list:X86 ARCHITECTURE..." Subject: Re: [RFC PATCH] smpboot: Check for successfull allocation of cpumask vars In-Reply-To: Message-ID: References: <1418140999-29092-1-git-send-email-bobby.prani@gmail.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001,URIBL_BLOCKED=0.001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 9 Dec 2014, Pranith Kumar wrote: > On Tue, Dec 9, 2014 at 3:10 PM, Thomas Gleixner wrote: > > On Tue, 9 Dec 2014, Pranith Kumar wrote: > >> zalloc_cpumask_var() can return 0 on allocation failure when > >> CONFIG_CPUMASK_OFFSTACK is set. Check for the return value and WARN() on failure > >> of an allocation in such cases. > > > > And that warning helps in which way? > > > > It just prints a completely useless backtrace and breaks out of the > > loop, but it does not prevent that later on code will trip over the > > non allocated per cpu data. > > > > I agree. May be just a pr_warn() saying that an allocation failed perhaps? Yep. > To prevent further accesses, we can clear the cpu bit from the cpu > masks(online/possible/present) for the failed cpu and continue trying > to allocate for other cpus. We don't break out of the loop. Removing > the cpu from the cpu masks will disable accesses of the non allocated > per cpu data. > > What do you suggest we do in such cases? Pretty much what you said, but we should definitely break out of the loop. There is no point to try more allocations if we failed the first one. Thanks, tglx