From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20E2B395DA5 for ; Wed, 25 Mar 2026 16:49:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774457370; cv=none; b=RdlYhwr+3J1RwO8pbrIBkLXxa7XujAgzmyhMc0Fcj/jpbhpiOiPVd/MmnWZVODctIuePpjYWZHHWM7CiaptVBa8gR2gd6gnMxmeb9kG6ok6KjGbjj/KJq9I8MmMbmFCuCGmmDDHo+8UgH/SFrbyDFP8IOowFwpuL2pfciHVq6ys= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774457370; c=relaxed/simple; bh=iMGhwqFWkB54ZSWljJvvt29P23iRPNTtnPWO0uSjd5o=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kof6dEU21nVkzOr1GoIGlStDzOoj9Ywqh/Pt3SoOXokXoEMx6D9be90puDAIur/kt4TPE6Hka0gekf7nzhJnOLYATi8D4IJP16XzyTC9K9N3gymXiu0iYiW8aBk86SWm/Z8469jmZz08T2XQUQuEN1Hox0vpacImVC2eaGiAMcY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MYVSz005; arc=none smtp.client-ip=209.85.208.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MYVSz005" Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-38ad12fb595so11231661fa.0 for ; Wed, 25 Mar 2026 09:49:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774457365; x=1775062165; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=0KHc+LjoEpTOzgKnEsolcMaPHiEs9PP1WuXP2Jldb0w=; b=MYVSz005bYFjtaF0DJfrU5GN5BeHirHBAAJ0RomF8QHF9wbgY1cDXFCc6mQzEb3Xtx yIPTRt8+V18xOnMrjnH7O4/BJ8wMOmJNZH5xkYT/d9TEZysq0h0W9fmsQnFJWIOJ0qsw RaVgq+PaYppol9BrGyKkWu6Z++NJ1nuF8kZcX/potwsTQwqKsrkalOpzCkX9F39yY3Y/ kAD8fbAZZFYM4w9ANIBJj/fxGXS+9+ci7qD8taQrj8EURDEdjKKJPn/cuC6qbBz6eBvd dVCJFDcWafTLIEe9kEV6dDArTgZW1NBZpZU66SZdv/NkuuLEf/abtoMUFHxtSA3b3A9y w0gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774457365; x=1775062165; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0KHc+LjoEpTOzgKnEsolcMaPHiEs9PP1WuXP2Jldb0w=; b=slnZiWMZZzsjRm1kBeOC7Qs91kYAL6kgVGoGVjBf00rCnWWF93eYBRPkoWzqcysRYf IVmFGpPrhbTa1oZsTx+DCmsNPitwQpwT47v9yxusKiwpn/d92agambertToRNkzFagLA AsjXuUTH5qb7+FwO8I8/MYuL74zsb/hO6h8+2dYxukQmiubDR1ALAC83sJg2hQfDYnaU zoynIchDJeKydUd2uxhJFKDYuvppZYnRhAwXVUBpDx9fA4a2kpIPV8C22pMitQBHZYj7 Y3D107Es+bmgmjLEGI3NjCtM5Ia6G3Axtx9Y2Y1+Wlvutde/bR13Tx4QNwMmSbnfEjc2 xKGA== X-Forwarded-Encrypted: i=1; AJvYcCVP8WL/r246Hdxp5ubalE2cP/6NV60kRfVpiCnUvEZZCA55O5eLDWBNXvGu21Qvcq1s2ewKTmTD/qIf26Y=@vger.kernel.org X-Gm-Message-State: AOJu0Yw3arBgQcLq/ICO+ge1UAnJCxeq0OFLK+nCOQ2FzGJBuuw4XbsA n8mR1mrQoOGEoKSdjYSvFP5hqKREgjuu5lop908+iYIl23oS0rWJlUX2 X-Gm-Gg: ATEYQzz0BsQAIRmI0opGfSFNv1AyD4tbTlWPhZSn3k9zBnKx/XQcU+Bg2Mx7pobBvUO 6q3gegsymp+gnaXLYFrXQhX0ODf7y6JDcYGVxTTfHj9pOCWb2CLh3qwcY9inP3WNkGi1I/iEmtl /EiWvRvDmy+Dd0ENhKDzunHjn5VeKNP5EbIPnMiHmEdEv9kBFYhJb9BQfsVjnext7Gc9ARdNdH1 KEHOo9bESZngfQyidAsmuGSYJbqC7HVCkjfvt7upla0rLOoX09sDvgwWzE7AT5k3f+Pc9FyfsLU pER1mfiHBdhlmVFm0JcpU30DousRFlUnE8tDmoo1Z+H1xfK2VNaEs5p3NEzZiGkRSpnEOgyzkJH WF4/CFLx11sYUof5WBts34JcjAsAH3F55uhI5Aa+l2Bszt4gM/NJhvsEolPBlLZ42 X-Received: by 2002:a05:6512:15a9:b0:5a1:3d15:2861 with SMTP id 2adb3069b0e04-5a29b4f8bccmr1758576e87.6.1774457364681; Wed, 25 Mar 2026 09:49:24 -0700 (PDT) Received: from milan ([2001:9b1:d5a0:a500::24b]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5a2a06892b2sm13867e87.40.2026.03.25.09.49.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2026 09:49:23 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Wed, 25 Mar 2026 17:49:22 +0100 To: "David Hildenbrand (Arm)" , Muhammad Usama Anjum Cc: Muhammad Usama Anjum , Uladzislau Rezki , Zi Yan , Andrew Morton , Lorenzo Stoakes , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Nick Terrell , David Sterba , Vishal Moola , linux-mm@kvack.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Ryan.Roberts@arm.com, david.hildenbrand@arm.com Subject: Re: [PATCH v3 2/3] vmalloc: Optimize vfree Message-ID: References: <20260324133538.497616-1-usama.anjum@arm.com> <20260324133538.497616-3-usama.anjum@arm.com> <1D88CFF0-8A74-413F-9A6A-39E27B760AE1@nvidia.com> <84f14a13-6236-47ef-afc5-e168d16caeec@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Mar 25, 2026 at 05:34:08PM +0100, David Hildenbrand (Arm) wrote: > On 3/25/26 17:25, Muhammad Usama Anjum wrote: > > On 25/03/2026 4:16 pm, Uladzislau Rezki wrote: > >> On Wed, Mar 25, 2026 at 03:02:14PM +0000, Muhammad Usama Anjum wrote: > >>> Sorry, I didn't get it. How does having cond_resched() in this function > >>> affects __free_contig_range()? > >>> > >> It is not. What i am asking is about: > >> > >> > >> spin_lock(); > >> free_pages_bulk() > >> ... > >> > >> > >> so this is not allowed because there is cond_resched() call. We > >> can remove it and make it possible to invoke free_pages_bulk() under > >> spin-lock, __but__ only if for example other calls do not sleep: > >> > >> __free_contig_range() > >> memdesc_section() > >> free_prepared_contig_range() > >> ... > >> > >>> > >>> The current user of this function is only vfree() which is sleepable. > >>> > >> I know. But this function can be used by others soon or later. > >> > >> Another option is add a comment, saying that it is only for sleepable > >> contexts. > > Thank you for detailed response. I can move cond_resched() to vfree() and make > > free_pages_bulk() allowed to be called form sleepable context. But I feel the > > current implementation is better to avoid latency spikes. I'll put explicit > > comment that this function can only be called from sleepable contexts. > Sounds good! > That's probably good enough for now. It can accept arbitrarily large > areas, so the cond_resched() in there is the right thing to do. :) > I agree, since it will be available for other callers, adding the comment is a right way, so people know :) -- Uladzislau Rezki