Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3493785pxf; Mon, 22 Mar 2021 07:43:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuNzWNkr6A3tE+EfnucJwy4AHOTKRm/CjSwncB0DU/PkzzT2jLAYJYUKxacOsOEIve2cc1 X-Received: by 2002:a17:906:314f:: with SMTP id e15mr127119eje.30.1616424191155; Mon, 22 Mar 2021 07:43:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616424191; cv=none; d=google.com; s=arc-20160816; b=sVbwgDL1DXeE+0cMdtCeTcp3vNG/EZtskDLHxYzXMVFcsCWFaRmU6Bz1arcHZ51dvG oM5EiKPw0OJ7jWaBYOzWqUCYaqBUtEQapSXO/RbLn4CO2V4oCrrhjGmei8fDmBbnfMUF 0xVJKcWsyiTIWEqpwiKJ5DQuEMFZbaxIY5LdG2QMZgbdYW6bM0H/Qonh4mDXF47ce35B 6sMPF/+6ctfeKlev/1GzISXCnLusylxY62QoMGoDwHGlXnq9bk+RU2t6iMhrrQ4rJxsJ VGdnZVbRLKo72n64Mbcgt47GpJpuIZa3lkextW32ICk0C00KecyloTw2oQMrZoI/Etpu VV2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RaCtvaHwo/TZn625kVRWBgdSA5no54J7WgYPxjdoG7E=; b=QkNsRLaVS+kIiTUaPdm9Z7PRgDl69ExEav4aODnoeWes+wtOfPI1l/XfNtBWqJQuY8 EldZLrKhcNHDqzNOzIqYjZ5/ZOwB+D4jHMpHgfWNSfTXod3MBb1BVJqdrdr/01O9z/ER pKYKLg9h2SEOYEQ2sXqR693lHUmVocQpCL4Fsp7zUy+/8IRWQoO20RysjACFmS8T/SrW ZCwTkMnIsbwM5hIbHD5mVZVEvzVLFlIbdmNk4bg4Yi+Inuom3IAL+iPBQPnYsaKgg5KD Lf/1XyAXC3if1aeYU7jMrZZkxfBIpzwVvF4Lfa3/S/03kHVK185Maf1hU/XrYKYZKe5E JwgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="SBc/ON5t"; 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 lz9si11416092ejb.57.2021.03.22.07.42.48; Mon, 22 Mar 2021 07:43:11 -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=@infradead.org header.s=casper.20170209 header.b="SBc/ON5t"; 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 S230071AbhCVOlv (ORCPT + 99 others); Mon, 22 Mar 2021 10:41:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbhCVOlq (ORCPT ); Mon, 22 Mar 2021 10:41:46 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5C0FC061574; Mon, 22 Mar 2021 07:41:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=RaCtvaHwo/TZn625kVRWBgdSA5no54J7WgYPxjdoG7E=; b=SBc/ON5tkAeoJz8M87KOQ19vrw pnuWSCSN/BuNgJ+CWCe/pwoQtp6ETfywBh/717fidsZmO2NyhCTYf/NJv13xHd/PjtpgrNamKbVFH vlEZfh31D8qSobxBbpQG5m9Tiw1nuMFjPL+s+3qreV7lYaAW6refD51xr+hOOL8PPZiNkLtfOqIfw cCU+1LbS6gcak/jVmi4WDUUnPCn7apvJvyX/AX7xO9oT9rSq29/O9rlZt0i5XRL6cRBVBF5In3p4E nWiJaLsxIR7N/PXp9+jpOQtWHBdMQySi1wiYvoEfTXTUpiaMPUpF1VILs3rDuGGGtaxmWsqWxxfJ1 2gbarSiQ==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lOLjW-008epC-Iy; Mon, 22 Mar 2021 14:40:43 +0000 Date: Mon, 22 Mar 2021 14:40:42 +0000 From: Matthew Wilcox To: Christoph Hellwig Cc: Sergey Senozhatsky , Namjae Jeon , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-cifsd-devel@lists.sourceforge.net, smfrench@gmail.com, hyc.lee@gmail.com, viro@zeniv.linux.org.uk, hch@infradead.org, ronniesahlberg@gmail.com, aurelien.aptel@gmail.com, aaptel@suse.com, sandeen@sandeen.net, dan.carpenter@oracle.com, colin.king@canonical.com, rdunlap@infradead.org, Sergey Senozhatsky , Steve French Subject: Re: [PATCH 3/5] cifsd: add file operations Message-ID: <20210322144042.GO1719932@casper.infradead.org> References: <20210322051344.1706-1-namjae.jeon@samsung.com> <20210322051344.1706-4-namjae.jeon@samsung.com> <20210322081512.GI1719932@casper.infradead.org> <20210322135718.GA28451@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210322135718.GA28451@lst.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 22, 2021 at 02:57:18PM +0100, Christoph Hellwig wrote: > On Mon, Mar 22, 2021 at 06:03:21PM +0900, Sergey Senozhatsky wrote: > > On (21/03/22 08:15), Matthew Wilcox wrote: > > > > > > What's the scenario for which your allocator performs better than slub > > > > > > > IIRC request and reply buffers can be up to 4M in size. So this stuff > > just allocates a number of fat buffers and keeps them around so that > > it doesn't have to vmalloc(4M) for every request and every response. > > Do we have any data suggesting it is faster than vmalloc? Oh, I have no trouble believing it's faster than vmalloc. Here's the fast(!) path that always has memory available, never does retries. I'm calling out the things I perceive as expensive on the right hand side. Also, I'm taking the 4MB size as the example. vmalloc() __vmalloc_node() __vmalloc_node_range() __get_vm_area_node() [allocates vm_struct] alloc_vmap_area() [allocates vmap_area] [takes free_vmap_area_lock] __alloc_vmap_area() find_vmap_lowest_match [walks free_vmap_area_root] [takes vmap_area_lock] __vmalloc_area_node() ... array_size is 8KiB, we call __vmalloc_node __vmalloc_node [everything we did above, all over again, two more allocations, two more lock acquire] alloc_pages_node(), 1024 times vmap_pages_range_noflush() vmap_range_noflush() [allocate at least two pages for PTEs] There's definitely some low handling fruit here. __vmalloc_area_node() should probably call kvmalloc_node() instead of __vmalloc_node() for table sizes > 4KiB. But a lot of this is inherent to how vmalloc works, and we need to put a cache in front of it. Just not this one.