From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68B7AEB64D7 for ; Wed, 21 Jun 2023 20:14:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229472AbjFUUO0 (ORCPT ); Wed, 21 Jun 2023 16:14:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230142AbjFUUOY (ORCPT ); Wed, 21 Jun 2023 16:14:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EBD119A2 for ; Wed, 21 Jun 2023 13:14:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 76E8E616C2 for ; Wed, 21 Jun 2023 20:14:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC298C433C0; Wed, 21 Jun 2023 20:14:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1687378454; bh=gZgjuVf9Iur9eLSGjaqvfb4JWsZDX9b5kLjhh2tmWvU=; h=Date:To:From:Subject:From; b=0Xnob0wD8NzT9pBZdK9xCJ9fbHdv4Nn4YIoefbuxENgNlrDsAhfzp/L41a9kjc+B+ NmKtjke790jlnqm+Fxki1xhR9h6586Qi71O2Ue4r8QcV4vciK4qHVu/M8/Kqmsd8iy anyFp1jNtNHHjhZTdVnjzE22rFmxgAPexsjPJHzo= Date: Wed, 21 Jun 2023 13:14:14 -0700 To: mm-commits@vger.kernel.org, willy@infradead.org, akpm@linux-foundation.org From: Andrew Morton Subject: + scatterlist-add-sg_set_folio.patch added to mm-unstable branch Message-Id: <20230621201414.CC298C433C0@smtp.kernel.org> Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The patch titled Subject: scatterlist: add sg_set_folio() has been added to the -mm mm-unstable branch. Its filename is scatterlist-add-sg_set_folio.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/scatterlist-add-sg_set_folio.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: "Matthew Wilcox (Oracle)" Subject: scatterlist: add sg_set_folio() Date: Wed, 21 Jun 2023 17:45:47 +0100 This wrapper for sg_set_page() lets drivers add folios to a scatterlist more easily. We could, perhaps, do better by using a different page in the folio if offset is larger than UINT_MAX, but let's hope we get a better data structure than this before we need to care about such large folios. Link: https://lkml.kernel.org/r/20230621164557.3510324-4-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Andrew Morton --- include/linux/scatterlist.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) --- a/include/linux/scatterlist.h~scatterlist-add-sg_set_folio +++ a/include/linux/scatterlist.h @@ -141,6 +141,30 @@ static inline void sg_set_page(struct sc sg->length = len; } +/** + * sg_set_folio - Set sg entry to point at given folio + * @sg: SG entry + * @folio: The folio + * @len: Length of data + * @offset: Offset into folio + * + * Description: + * Use this function to set an sg entry pointing at a folio, never assign + * the folio directly. We encode sg table information in the lower bits + * of the folio pointer. See sg_page() for looking up the page belonging + * to an sg entry. + * + **/ +static inline void sg_set_folio(struct scatterlist *sg, struct folio *folio, + size_t len, size_t offset) +{ + WARN_ON_ONCE(len > UINT_MAX); + WARN_ON_ONCE(offset > UINT_MAX); + sg_assign_page(sg, &folio->page); + sg->offset = offset; + sg->length = len; +} + static inline struct page *sg_page(struct scatterlist *sg) { #ifdef CONFIG_DEBUG_SG _ Patches currently in -mm which might be from willy@infradead.org are afs-convert-pagevec-to-folio_batch-in-afs_extend_writeback.patch mm-add-__folio_batch_release.patch scatterlist-add-sg_set_folio.patch i915-convert-shmem_sg_free_table-to-use-a-folio_batch.patch drm-convert-drm_gem_put_pages-to-use-a-folio_batch.patch mm-remove-check_move_unevictable_pages.patch pagevec-rename-fbatch_count.patch i915-convert-i915_gpu_error-to-use-a-folio_batch.patch net-convert-sunrpc-from-pagevec-to-folio_batch.patch mm-remove-struct-pagevec.patch mm-rename-invalidate_mapping_pagevec-to-mapping_try_invalidate.patch mm-remove-references-to-pagevec.patch mm-remove-unnecessary-pagevec-includes.patch