Received: by 10.223.185.116 with SMTP id b49csp5298454wrg; Wed, 7 Mar 2018 09:24:53 -0800 (PST) X-Google-Smtp-Source: AG47ELtTbwdr3gb112g8pN2dq9q6yTa7MVakiDESZVC1whK9TJG2WigBuYFA65GnKS8Zeih7R1M5 X-Received: by 2002:a17:902:9a45:: with SMTP id x5-v6mr11374437plv.18.1520443493895; Wed, 07 Mar 2018 09:24:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520443493; cv=none; d=google.com; s=arc-20160816; b=tsViME35t36jaDgceUb5TnzTjZ3WzCr1dS7YvEH0H2qbNeW37zD0szlP/nYMkyMMc+ L+tdbQzZ0CPU5ylYuIBk/KXth11H9wSvDmTctCpvsxQaZ59tTlctQesA22x1roIXNxRU SABIJ33jLReNoOQemXlXO+mwEE4ITYg3Vj9+BsySWt6YjJgL2sg+FExGT5bOTdUOWVfy mE2OTua5S/cl5W8oLnFWnWxl1dNLs5NYqNqdSX42sygDRmwMZhQrWUxMCUvDOKUwGu/F dKJsrDJo1RWrTBbjDDBqwTwv3LVTqa66IOIw+pOVbLzQxbJ+9EENpeiI2mwK8aWFIwCB 8+Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=kWmWQStrBCcTFyZIfYyo97HrJ7/grPujs0UuoYlugQk=; b=hXmvRdB1/D3X4ILaqt5l6L3i5RjJ5UFi+C6PWoykvAXrWrYZEr0ALpDuHbGbD+f1bD z9vV7Qgq52p7ChLJ5gX3wAbVLRDlYyHKvM5+ALae8+PAK+lszlBzXbH/sXR1dgoGBIkC ZHk6bTI+2kNgMJTXsDcY2735Q+OF4Ye/JP6TimAwuvDqlrJV9pO1cWQngolCz9l8VgUG V45qDgKmW7rqJpfE/B7qXhxQaSekbtxfFgBqGd/TYHAPPdEUbGLnGYg+V8E4dhcb2aup tPMVBMeUj/nRz+Nuw4JjM43rCFQkCggFMUklUouQIfAofh0a/oaujNx/YVRIaChzSX+1 hVzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ursulin-net.20150623.gappssmtp.com header.s=20150623 header.b=kBD0PErX; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11si11593672pgq.439.2018.03.07.09.24.38; Wed, 07 Mar 2018 09:24:53 -0800 (PST) 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; dkim=pass header.i=@ursulin-net.20150623.gappssmtp.com header.s=20150623 header.b=kBD0PErX; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933278AbeCGRXa (ORCPT + 99 others); Wed, 7 Mar 2018 12:23:30 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:40082 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754333AbeCGRXY (ORCPT ); Wed, 7 Mar 2018 12:23:24 -0500 Received: by mail-wr0-f194.google.com with SMTP id o76so2959242wrb.7 for ; Wed, 07 Mar 2018 09:23:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=kWmWQStrBCcTFyZIfYyo97HrJ7/grPujs0UuoYlugQk=; b=kBD0PErXxmaoiEDa952rYHoH86cjnhZvZ6fM9a37C0Mi9JnTbaOVH8xFIB3Bv4Snf3 KhwZVjoKpKbOe/z3IJkE0/kpa60J8He7o4hcH7x/w911tjwNNhEQZ2YOu8vlq+/oPMnY UknfK/Dh1ZnSVm6Zp/9Whbfbve3/jbDwG95l3jq3+MBQrx/UuwpAHOqabFTbqQcnLErM dzhgM39iBOzNcotD6t4zmb17wqbeiqk9Xd8ZJYSd4JJfZ1ekNpcBeLRb7GsRu1b092QP vOeXaNyenfEo0MFl4sU4xI6F/TQGURnE5rhLKQzqSjRCd4f9TNlGXRX19eqe8EtND290 6PDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=kWmWQStrBCcTFyZIfYyo97HrJ7/grPujs0UuoYlugQk=; b=X5ayg/m3wWrZ0SwzraVRnxLHCZjXBbh5y0HEJLXgrZ/Kxaioao9T/PUqH1L3dZzo1h PL/TuS8PCUc5xOrgcfmKnnRo4Vz52ZqrTaBwL/rPk6udvau0k3E5WjZYa016ZoLRp3Jg 5msZCtDlml/ek8RJwlNuoTbBv/g9h5O/RNkMcwE6p21BY2BFMHN5/EfEJ3sBj0YKKShy m7QlHoX+vhbx9+iipP+CJE82+5BhK2PbBPANBwC/pXS8rb1UH6JDEB4N59BwW199Xr7C zMytytB7zV0C0EtsK7O7t/s5kf2bVt7b9Rj+HCMvbv6T3b87aOmi9GWhZpgH2l+t+Lwf yHNQ== X-Gm-Message-State: APf1xPDM8SQhn9Jn2cY1t1ngOLtQC2M4bLoan0DIWDyh85wAaHu/2tNt yIX5pjT6MdcfEc1nIw4wcoZ2ww== X-Received: by 10.223.143.101 with SMTP id p92mr19481912wrb.241.1520443402952; Wed, 07 Mar 2018 09:23:22 -0800 (PST) Received: from [192.168.0.153] ([95.146.144.186]) by smtp.googlemail.com with ESMTPSA id h197sm18149469wmd.17.2018.03.07.09.23.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Mar 2018 09:23:22 -0800 (PST) Subject: Re: [PATCH 6/6] lib/scatterlist: Drop order argument from sgl_free_n_order To: Bart Van Assche , "linux-kernel@vger.kernel.org" Cc: "linux-scsi@vger.kernel.org" , "tvrtko.ursulin@intel.com" , "hare@suse.com" , "jthumshirn@suse.de" , "target-devel@vger.kernel.org" , "axboe@kernel.dk" , "nab@linux-iscsi.org" References: <20180307124712.14963-1-tvrtko.ursulin@linux.intel.com> <20180307124712.14963-7-tvrtko.ursulin@linux.intel.com> <1520439817.2890.21.camel@wdc.com> From: Tvrtko Ursulin Message-ID: <37786476-a4e8-ce70-abff-35d99413fa68@ursulin.net> Date: Wed, 7 Mar 2018 17:23:21 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1520439817.2890.21.camel@wdc.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/03/18 16:23, Bart Van Assche wrote: > On Wed, 2018-03-07 at 12:47 +0000, Tvrtko Ursulin wrote: >> We can derive the order from sg->length and so do not need to pass it in >> explicitly. Rename the function to sgl_free_n. > > Using get_order() to compute the order looks fine to me but this patch will > have to rebased in order to address the comments on the previous patches. Ok I guess my main questions are the ones from the cover letter - where is this API going and why did it get in a bit of a funky state? Because it doesn't look fully thought through and tested to me. My motivation is that I would like to extend it to add sgl_alloc_order_min_max, which takes min order and max order, and allocates as large chunks as it can given those constraints. This is something we have in i915 and could then drop our implementation and use the library function. But I also wanted to refactor sgl_alloc_order to benefit from the existing chained struct scatterlist allocator. But SGL API does not embed into struct sg_table, neither it carries explicitly the number of nents allocated, making it impossible to correctly free with existing sg_free_table. Another benefit of using the existing sg allocator would be that for large allocation you don't depend on the availability of contiguous chunks like you do with kmalloc_array. For instance if in another reply you mentioned 4GiB allocations are a possibility. If you use order 0 that means you need 1M nents, which can be something like 32 bytes each and you need a 32MiB kmalloc for the nents array and thats quite big. If you would be able to reuse the existing sg_alloc_table infrastructure (I have patches which extract it if you don't want to deal with struct sg_table), you would benefit from PAGE_SIZE allocations. Also I am not sure if a single gfp argument to sgl_alloc_order is the right thing to do. I have a feeling you either need to ignore it for kmalloc_array, or pass in two gfp_t arguments to be used for metadata and backing storage respectively. So I have many questions regarding the current state and future direction, but essentially would like to make it usable for other drivers, like i915, as well. Regards, Tvrtko