Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp514995ybi; Thu, 11 Jul 2019 23:57:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0W12MX63/q3zJb2SVDJH4Uc7Bd92koQbcyespk3MsNwoVSlPAQ341ptRIszVA8lB8Ygsk X-Received: by 2002:a17:902:758d:: with SMTP id j13mr5623749pll.197.1562914630257; Thu, 11 Jul 2019 23:57:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562914630; cv=none; d=google.com; s=arc-20160816; b=jUCfCDyw+Tt97VatRLuO8blqIGbfIvsVDespwwbBbUd1jC+d085DmP3Q28l5wVP2eW MMPzO+f4FA58kZDGKj3NqPWMGFfJbsx4clUlQzLRBacNxEqE+2YvpGaGI0el45/TICoS MGbvekijNBZICSxNVnpSKQCghlj01z9EXaf8bg/KjKjiWT/T1yUSz2/ec1SzYHisJsD7 D9Ua/EyR8eQusx1boRMmjGJaKoM2RMPq73+9P8ut9g/Szh5Glchr5EDs4Dkydfd9Ong8 2gNcfxs3x9NCjGbnJCHUVn0wCLUAaYgTf2XD4MGtMkNp7BkZTgx+PefJZUdPpHA8atKM Bzng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=uBMMOjhIaaDNY9Q09kLI6Fr2J4wf8kvOJyP8H+SZMcc=; b=cc7WYBMJmVmJu8jy8fgmysGOuR5RAlur8Rds2vPOJti0BKQ3g3VvUvPGdSgmEZlLxw /vV4dx7nmOUNa3M4dJ75yTjOnbp8MMlADeIz6p30tZdSOaDVoZZGHpcRLyz4zLHmJGi7 9yAt4SD9Uat3QPGh0FYwxn4rrUqXhAeGn2DhKWXLjhBbq33gUh6x9/kbLdaaLor6omNb psiZP01LWSlDG+jOeTzP03C0f67S4TKZmg8AGHoWQ8wL1YHfWmMne9eVCnFpdKl+/yvg pHd5eTIY+Zek3weIOhnZGQBd/Cj5MN8DaGtSCC5ju/bgQLmSLJWktbE3avK9X6tFXRKU FPlA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f33si7180153pjg.81.2019.07.11.23.56.53; Thu, 11 Jul 2019 23:57:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726057AbfGLG4e (ORCPT + 99 others); Fri, 12 Jul 2019 02:56:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53018 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725846AbfGLG4e (ORCPT ); Fri, 12 Jul 2019 02:56:34 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DD1204ACDF; Fri, 12 Jul 2019 06:56:33 +0000 (UTC) Received: from ming.t460p (ovpn-8-28.pek2.redhat.com [10.72.8.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C69065C69A; Fri, 12 Jul 2019 06:56:21 +0000 (UTC) Date: Fri, 12 Jul 2019 14:56:15 +0800 From: Ming Lei To: Sultan Alsawaf Cc: Jason Gunthorpe , Palmer Dabbelt , "Martin K. Petersen" , Gal Pressman , Allison Randal , Christophe Leroy , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH] scatterlist: Allocate a contiguous array instead of chaining Message-ID: <20190712065613.GA3036@ming.t460p> References: <20190712063657.17088-1-sultan@kerneltoast.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190712063657.17088-1-sultan@kerneltoast.com> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 12 Jul 2019 06:56:34 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 11, 2019 at 11:36:56PM -0700, Sultan Alsawaf wrote: > From: Sultan Alsawaf > > Typically, drivers allocate sg lists of sizes up to a few MiB in size. > The current algorithm deals with large sg lists by splitting them into > several smaller arrays and chaining them together. But if the sg list > allocation is large, and we know the size ahead of time, sg chaining is > both inefficient and unnecessary. > > Rather than calling kmalloc hundreds of times in a loop for chaining > tiny arrays, we can simply do it all at once with kvmalloc, which has > the proper tradeoff on when to stop using kmalloc and instead use > vmalloc. vmalloc() may sleep, so it is impossible to be called in atomic context. Thanks, Ming