From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCDBBC07E96 for ; Tue, 6 Jul 2021 20:26:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5F75261C90 for ; Tue, 6 Jul 2021 20:26:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F75261C90 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 366AB6B0011; Tue, 6 Jul 2021 16:26:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 33D796B0036; Tue, 6 Jul 2021 16:26:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1DF066B005D; Tue, 6 Jul 2021 16:26:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id E5EF56B0011 for ; Tue, 6 Jul 2021 16:26:55 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 43DB18249980 for ; Tue, 6 Jul 2021 20:26:55 +0000 (UTC) X-FDA: 78333296790.08.179BEF1 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf26.hostedemail.com (Postfix) with ESMTP id E0A9C200170C for ; Tue, 6 Jul 2021 20:26:54 +0000 (UTC) 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 Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=nUyYUbAl; dmarc=none; spf=pass (imf26.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Stat-Signature: 6rkdbscyeu1biw4n46dzgora5xuakyqs X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: E0A9C200170C X-HE-Tag: 1625603214-17514 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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?