Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3448235pxu; Mon, 19 Oct 2020 12:20:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuzw48tzaTVr/uncL+yd81YbIiBAXVA+pTergHBvFNG3SxYpQHy6UjfRdH0BBq39rhHRF3 X-Received: by 2002:a17:906:4a98:: with SMTP id x24mr1343307eju.319.1603135257104; Mon, 19 Oct 2020 12:20:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603135257; cv=none; d=google.com; s=arc-20160816; b=GdxkjSd/yaoq8TmO5uhjYEmIjQ3hWTU5t/PPcj3r0JMahc0PSLaUwFZ+HEzZcDQsC+ hLqFhbXrf7fbfIAoEC69sdvPR49zFKl56CLb8eC6I8NNFSUHEguLNNcL8ImR62XR3x0T 0/Iv5Zh/x6lsVtfuXlVAbwlFsgR4C7lRfpCdQksVpWAPlTrR3C3XUcT4X4iBjw+VuU6X qWek93XjtQwoEKLf9j/18RLfEb3Cdux7lXTUHQo3eKlJpk5PUUKoNBdis3J5lZiC7KTC fMStYIXr33V6objRBeaKkoDuyD4moSgyNYO4G9NVwhfznc0AV59qr/cJt6IpGoaVIokS kMlg== 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 :message-id:date:subject:cc:to:from; bh=06a48CTyYizZZaTYZ0h2rP00uwWWAxA3bd8YC9cVywo=; b=qgh1nUizzIdReaNsOFIfYsHEeRbtHTM6HM0YHQHDjoiiR1Wf1l2Ky9lb9qArPEAYDP kKVZhJd2zVtmuZIxTaxoqfmBwJ/9AAiLnIgzAjTA7n4ZSsiqspdWorzv9T0ajh1lQv81 6GmxJKw0zJNb840xlpzWZ8DnGbhH+VI6EpHKv5ZT1f6LPCbCJFNR5Ju3rDsiIjcOoNJt t0JyDfAb80w8U+AucsjGQkexeL/NX4lwZInK6KqfW/GKWAUFFn8UvizPyUoYkO/TleoD hCiZEq7mtq/9WyIVZL8l5nHG8Ph4uaw/zR60QuDFcfduxUoUMqL1QsvQAscKkvs+OuzH Iw9Q== ARC-Authentication-Results: i=1; mx.google.com; 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 bv12si569595ejb.662.2020.10.19.12.20.34; Mon, 19 Oct 2020 12:20:57 -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; 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 S1731095AbgJSTTf (ORCPT + 99 others); Mon, 19 Oct 2020 15:19:35 -0400 Received: from smtp.infotech.no ([82.134.31.41]:56022 "EHLO smtp.infotech.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730938AbgJSTTf (ORCPT ); Mon, 19 Oct 2020 15:19:35 -0400 Received: from localhost (localhost [127.0.0.1]) by smtp.infotech.no (Postfix) with ESMTP id 5ABDC204248; Mon, 19 Oct 2020 21:19:32 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.6.6 (20110518) (Debian) at infotech.no Received: from smtp.infotech.no ([127.0.0.1]) by localhost (smtp.infotech.no [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M1MqUhragf6R; Mon, 19 Oct 2020 21:19:32 +0200 (CEST) Received: from xtwo70.bingwo.ca (vpn.infotech.no [82.134.31.155]) by smtp.infotech.no (Postfix) with ESMTPA id 0AF2520414F; Mon, 19 Oct 2020 21:19:30 +0200 (CEST) From: Douglas Gilbert To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: martin.petersen@oracle.com, axboe@kernel.dk, bvanassche@acm.org, bostroesser@gmail.com Subject: [PATCH v3 0/4] scatterlist: add new capabilities Date: Mon, 19 Oct 2020 15:19:24 -0400 Message-Id: <20201019191928.77845-1-dgilbert@interlog.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Scatter-gather lists (sgl_s) are frequently used as data carriers in the block layer. For example the SCSI and NVMe subsystems interchange data with the block layer using sgl_s. The sgl API is declared in The author has extended these transient sgl use cases to a store (i.e. a ramdisk) in the scsi_debug driver. Other new potential uses of sgl_s could be for caches. When this extra step is taken, the need to copy between sgl_s becomes apparent. The patchset adds sgl_copy_sgl() and two other sgl operations. The existing sgl_alloc_order() function can be seen as a replacement for vmalloc() for large, long-term allocations. For what seems like no good reason, sgl_alloc_order() currently restricts its total allocation to less than or equal to 4 GiB. vmalloc() has no such restriction. Changes since v2 [posted 20201018]: - remove unneeded lines from sgl_memset() definition. - change sg_zero_buffer() to call sgl_memset() as the former is a subset. Changes since v1 [posted 20201016]: - Bodo Stroesser pointed out a problem with the nesting of kmap_atomic() [called via sg_miter_next()] and kunmap_atomic() calls [called via sg_miter_stop()] and proposed a solution that simplifies the previous code. - the new implementation of the three functions has shorter periods when pre-emption is disabled (but has more them). This should make operations on large sgl_s more pre-emption "friendly" with a relatively small performance hit. - sgl_memset return type changed from void to size_t and is the number of bytes actually (over)written. That number is needed anyway internally so may as well return it as it may be useful to the caller. This patchset is against lk 5.9.0 Douglas Gilbert (4): sgl_alloc_order: remove 4 GiB limit, sgl_free() warning scatterlist: add sgl_copy_sgl() function scatterlist: add sgl_compare_sgl() function scatterlist: add sgl_memset() include/linux/scatterlist.h | 12 +++ lib/scatterlist.c | 186 +++++++++++++++++++++++++++++++++--- 2 files changed, 184 insertions(+), 14 deletions(-) -- 2.25.1