Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1977151pxb; Fri, 5 Mar 2021 04:36:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyV1E2BV+HwwlDIc3vmK8WmgRb04RetjeamBl3ccYjnK0mL0JQngWcKyW/7S3AncPYhh/XM X-Received: by 2002:a17:906:5acd:: with SMTP id x13mr1991818ejs.211.1614947790295; Fri, 05 Mar 2021 04:36:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614947790; cv=none; d=google.com; s=arc-20160816; b=dbcq485Yau764Z6vquKXabGrxZYDzcWQhr6NLJIE5klKkRBWHUmKWnEMvJAjKUUaHG mG+h782QHIVzpt3wTrpqYoup6GhK4nXboHABXqe26w41DrMSTKcNbUAousG5wADW4OVL mfdBvpU9xHDzRhDfJgbg4Q4WgSYUSQwG/BEqnXUkbxcPbjuNDJBkOhxofT/KhQmpIsvv iLxuBNx+ZVFYTtj8yvgP3BT4jD3qsws4IpPaolRGo1xpcvpIWsgjokfhlxHyW9UyMXGu 8/2q2lBK/TuNdCl8G1kl235V9TLbaROtpZsRrRB0axpJdy6kfYKRdhMGkzHjem/xKtbO umFA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jKGeGT+/SrZVFmZdfrUvFtank5IB2wVNwB/0dkuYUC0=; b=A3xTnuP2H1WNFM4nER7I0Spv3zd4bHKmY2oaSsJV6NblffvAxG74Haz3iuvQVMhD7T MXyEC4hRFWgrnOPj+lzyZo5qN3N//tgbtAz8l6lE23QucJSzrELqsN9+2/SAdT51PATz UaeRbZdCRxIXXS+8/ee0sUSAuRRcgZTKTK3kL8n2fMvrGEUJw0Iua012DqDS50ih1svL fZ4rt+PXg6YerUMEsGY2TqPIAgLIRQIulqTWu8UwZWY6Tl88sgvqLv7hoohCfqPlr91K 6EaSvqnNmxsWddlO3CorxVYMtRFz5z/7N9eN/jrCpl0P8+6zMEnc3RlntmXhZ5Se0K4s ijww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nKLZYBjf; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z7si1168364eja.451.2021.03.05.04.36.06; Fri, 05 Mar 2021 04:36:30 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=nKLZYBjf; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232720AbhCEMfQ (ORCPT + 99 others); Fri, 5 Mar 2021 07:35:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:46166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232285AbhCEMea (ORCPT ); Fri, 5 Mar 2021 07:34:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 258E965012; Fri, 5 Mar 2021 12:34:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614947669; bh=P+cUeh4MWr9XvlwwB5pVAtDPoya5pKSMT1ueVmTKsAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nKLZYBjf/UHh/iCDyzUdIZFTNmR31XPsOuvMdcPrrINCBn0N2/u+yBNLBs21KIQJc Zo1g5zVPfS10Z7DYLJvILGdSz8WkidMQGT/HU4yAFvA6qMRTJSYVX8ToNVzYQF2hrr 2qT+W5WHdWne/r1JdHBl8ppTTbWDthyD8pffeL78= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Senozhatsky , Gerd Hoffmann , Doug Horn Subject: [PATCH 5.4 24/72] drm/virtio: use kvmalloc for large allocations Date: Fri, 5 Mar 2021 13:21:26 +0100 Message-Id: <20210305120858.530070842@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305120857.341630346@linuxfoundation.org> References: <20210305120857.341630346@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergey Senozhatsky commit ea86f3defd55f141a44146e66cbf8ffb683d60da upstream. We observed that some of virtio_gpu_object_shmem_init() allocations can be rather costly - order 6 - which can be difficult to fulfill under memory pressure conditions. Switch to kvmalloc_array() in virtio_gpu_object_shmem_init() and let the kernel vmalloc the entries array. Signed-off-by: Sergey Senozhatsky Link: http://patchwork.freedesktop.org/patch/msgid/20201105014744.1662226-1-senozhatsky@chromium.org Signed-off-by: Gerd Hoffmann Signed-off-by: Doug Horn Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/virtio/virtgpu_vq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/virtio/virtgpu_vq.c +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c @@ -992,8 +992,9 @@ int virtio_gpu_object_attach(struct virt } /* gets freed when the ring has consumed it */ - ents = kmalloc_array(nents, sizeof(struct virtio_gpu_mem_entry), - GFP_KERNEL); + ents = kvmalloc_array(nents, + sizeof(struct virtio_gpu_mem_entry), + GFP_KERNEL); if (!ents) { DRM_ERROR("failed to allocate ent list\n"); return -ENOMEM;