Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4956805pxv; Tue, 6 Jul 2021 13:28:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzLLZM9HxjS2nowcd8/BCBZzjoATgNxzo8SX0l3KITpYGEmWYCtVQULj2bIv4Qbk9Pn2aw X-Received: by 2002:a17:906:2da1:: with SMTP id g1mr20270409eji.47.1625603294530; Tue, 06 Jul 2021 13:28:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625603294; cv=none; d=google.com; s=arc-20160816; b=LK1ez0jwwyIqsLWY5KoyXomho+TmufT7JdRSPbuo0dzK3dKXS8LLJ9L2GTp4oG/7de i57sJPdog17cKh4HLkcv5CL0/W73FVxRgq+3Byo1CMZEu565xPpiESFwjfLPZ/gHAUZZ Jof5BS0o+vTI3EA/5Fl5yD69P3hOfqw1M9ou6pRGKgBGAP71SpkL1kFoMwshP5V/bTaT 0wXiz4Hl+HBnMxXF5Gn76SapzcdSxQz4CRhe260p5mRXuqc0YsAE/GcHW+D+kpA/ESIS hC/mI0G5tza1K8heDJAKAzH5TfOQO6Eqh7TJzP1k4iYXkChlTJBn8lrRWUiljsQs2dx1 75GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=RdDtGnmWmX6pI7LilUe+bFh45r4q0TauuRTyQhdiFhI=; b=y5+WhsjZRkQb5jU6VHterrRN4/6GySwByfYgNniyQan7jx7EdT5j9nOriaRkxxQXyw 4/GkRI2GmIjgBRKIgrgXPRXhTy+Wk/La+jgBzbTj1u8lY7mhMlIHIXZ6P+tq0PcoIn46 sK7E+b7UZwHEvGyY002gpGT32d1/awGGBhGwQ4dFbmLFfc9FMULGwrn4eefTgQe62yb7 +fREQoSFMcCmaSxmM2hCq28WCOGGu/khWAmVtm8lPMtUYzj0a5j8d0T+zE29Ok2wmyof Bd8mqOm5QJyJTKIlPui70qftT0LOnGORGtOu0BcG1+N0B0jtrlHg5TRjcOanHQ9dNte+ XmcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=nUyYUbAl; 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 cw15si3328862ejc.96.2021.07.06.13.27.51; Tue, 06 Jul 2021 13:28:14 -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=@linux-foundation.org header.s=korg header.b=nUyYUbAl; 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 S229986AbhGFU3d (ORCPT + 99 others); Tue, 6 Jul 2021 16:29:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:42490 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229781AbhGFU3d (ORCPT ); Tue, 6 Jul 2021 16:29:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C5C9F61C8C; Tue, 6 Jul 2021 20:26:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1625603214; bh=JBUwlxlI8gE1oqPvzBshifB+DVQmCTX9FdZGWFRtxiI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nUyYUbAlvH2OW/GGOiYtlUj+QHcLyb+/xnsr3VDm4hCWo1xnnhuAlTZC5Jh0wsLlU GNu6MhnL0pMjpsT/ByzQVTaJPaF3WCHdlV0niIzEfOlPksNdn9t9pZWKBwb2pxqavK 376cF59WNCjf38gp4UcKRfba1Z02OeeygOTRcsxA= Date: Tue, 6 Jul 2021 13:26:53 -0700 From: Andrew Morton To: "Uladzislau Rezki (Sony)" Cc: linux-mm@kvack.org, LKML , Mel Gorman , Christoph Hellwig , Matthew Wilcox , Nicholas Piggin , Hillf Danton , Michal Hocko , Oleksiy Avramchenko , Steven Rostedt Subject: Re: [PATCH v2 1/2] mm/vmalloc: Use batched page requests in bulk-allocator Message-Id: <20210706132653.8374852963b25989e360d599@linux-foundation.org> In-Reply-To: <20210705170537.43060-1-urezki@gmail.com> References: <20210705170537.43060-1-urezki@gmail.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 5 Jul 2021 19:05:36 +0200 "Uladzislau Rezki (Sony)" wrote: > In case of simultaneous vmalloc allocations, for example it is 1GB and > 12 CPUs my system is able to hit "BUG: soft lockup" for !CONFIG_PREEMPT > kernel. > > > ... > > are obtained, i.e. do batched page requests adding cond_resched() meanwhile > to reschedule. Batched value is hard-coded and is 100 pages per call. > > Signed-off-by: Uladzislau Rezki (Sony) Can we please have a Fixes: for this? Is this fix important enough for 4.14-rcx? I think so... > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -2785,10 +2785,32 @@ vm_area_alloc_pages(gfp_t gfp, int nid, > * to fails, fallback to a single page allocator that is > * more permissive. > */ > - if (!order) > - nr_allocated = alloc_pages_bulk_array_node( > - gfp, nid, nr_pages, pages); > - else > + if (!order) { > + while (nr_allocated < nr_pages) { > + int nr, nr_pages_request; > + > + /* > + * A maximum allowed request is hard-coded and is 100 > + * pages per call. That is done in order to prevent a > + * long preemption off scenario in the bulk-allocator > + * so the range is [1:100]. > + */ > + nr_pages_request = min(100, (int)(nr_pages - nr_allocated)); Yes, they types are all over the place. nr_pages: unsigned long nr_allocated: unsigned int nr, nr_pages_request: int Can we please choose the most appropriate type and use that consistently?