Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1979542pxb; Fri, 5 Mar 2021 04:40:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJwSixTdA/vul44Uye7HgYjTIzXJZm4dzrgt2FvLiXQAsV5ou/Pr7ATJVNvdrhUW7XBVeOa2 X-Received: by 2002:a17:906:c405:: with SMTP id u5mr2074206ejz.341.1614948001711; Fri, 05 Mar 2021 04:40:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614948001; cv=none; d=google.com; s=arc-20160816; b=U0E/sR3xLZBc9gXRrHPvI/7sqv0+gRafuu160rPH8T7OZHkNHzi0PBHD6nqqESJwCC dLXAIYgmJC+CKFgutTm+9osKpIxx6sZpquIZFXKDzlYuwfZBsyMrtaLf4M3ipKIzNa1z A2USDDL8Bv7dP8VNpZ8eMelg0++KrbChhuB7J3deoFeDsFeGBCeTHIPZczGC3qpL/Sq+ IoLdPnUXmkaBag7flGUfDpfYj+xnfnt8pBAKdtKuKm/3xt6CHx3ybUSrJSRm/xog49aL l4aVQkEhiMh+HV6z7K8yt7R90i4Ip7MdaiU6Dn0PqeAkMm63IIbNeCa48D47sEhCcv8R U1RA== 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=S31b9ipUZD7pe4D9yVSUnQ25KuIYfKIUlGqFjS22k8w=; b=YqojAaHt+2j5hjB2AYvvW8OeBUU2Wt7CbRomr9QzepZ22T66/bWJNin9NK8CUaDwa+ kDq9XdnFClzbmbNtMYF9PASxQ705SyXD2Go1bmJTphyW2eldceUysTut6qoZU9nW57Wo cmXX+Wv3wH3LOsCv5NRrmZHRXQffTYhp7y+P9PadPgDYogro+rRdSs8EYn+04hZFPp7A EIno0wQQdqCNerMTsv51vW9ayt1xYMA+BqfoQnwKGpTzNifYzUZ9JCm71o3GrSwNUarz RUN3JPSe2KFjmMr18cqglpioI01ZIzUKmaRkINOdFP9nd9VWveKpOoGfZjPxPC9+haPG XLAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vdEgkhzn; 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 n2si1278337ejy.130.2021.03.05.04.39.38; Fri, 05 Mar 2021 04:40:01 -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=vdEgkhzn; 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 S233214AbhCEMiJ (ORCPT + 99 others); Fri, 5 Mar 2021 07:38:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:50256 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233054AbhCEMhM (ORCPT ); Fri, 5 Mar 2021 07:37:12 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DD3076501B; Fri, 5 Mar 2021 12:37:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614947832; bh=3NGzFDKrJXS4I/2GBiL2uOxZfuT4lRQRB1jdRqdvHGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vdEgkhzna7bLO4qauOFaC0Qc+3/zBAGe7kMzHleZ01dHtC6yf5T9rp3PJdZnFQg0V aIYaoXAW0BEz3FPFk2YZ+zP/YbB4Sy3zMbjZJPluxBKmcb8pQI3CBhLH6SsLHaUMdf sVxqxrJBl4FY+7VGn4lPPAX2ZT1xCCLvPdYBBKJ4= 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 4.19 03/52] drm/virtio: use kvmalloc for large allocations Date: Fri, 5 Mar 2021 13:21:34 +0100 Message-Id: <20210305120853.828809591@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305120853.659441428@linuxfoundation.org> References: <20210305120853.659441428@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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/virtio/virtgpu_vq.c +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c @@ -868,9 +868,9 @@ int virtio_gpu_object_attach(struct virt } /* gets freed when the ring has consumed it */ - ents = kmalloc_array(obj->pages->nents, - sizeof(struct virtio_gpu_mem_entry), - GFP_KERNEL); + ents = kvmalloc_array(obj->pages->nents, + sizeof(struct virtio_gpu_mem_entry), + GFP_KERNEL); if (!ents) { DRM_ERROR("failed to allocate ent list\n"); return -ENOMEM;