From patchwork Sun Mar 19 00:20:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13180169 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22B26C7618A for ; Sun, 19 Mar 2023 00:20:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B432C900005; Sat, 18 Mar 2023 20:20:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AF333900004; Sat, 18 Mar 2023 20:20:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9BB18900005; Sat, 18 Mar 2023 20:20:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 8B0C4900004 for ; Sat, 18 Mar 2023 20:20:19 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 66E74A0205 for ; Sun, 19 Mar 2023 00:20:19 +0000 (UTC) X-FDA: 80583740958.15.E63AB73 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by imf21.hostedemail.com (Postfix) with ESMTP id A6B221C0012 for ; Sun, 19 Mar 2023 00:20:17 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ndkKPpYK; spf=pass (imf21.hostedemail.com: domain of lstoakes@gmail.com designates 209.85.221.44 as permitted sender) smtp.mailfrom=lstoakes@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679185217; a=rsa-sha256; cv=none; b=7jbzQWiwoja5tpvFzjX103qV73z710CDmOGPBPNaoJGMg+r1DKSQk9DYAxPmh+/qxYWcCn WFESEe3DxWRSkjJ2/v7dSgJr0PJWknANrQvMNY4Igs6w4ORgx2/cLWwyJmPf8AZynW0FUO AMD5fxrxuODsB1ejwLBdfo3wsIW88VU= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ndkKPpYK; spf=pass (imf21.hostedemail.com: domain of lstoakes@gmail.com designates 209.85.221.44 as permitted sender) smtp.mailfrom=lstoakes@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679185217; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=oBdvoOvvbPl4lveIHMcEslRaUIrEiN+QjBIu6nhpMoI=; b=xQ6IWTQ3qleGJBeDNUbZw93YbgMhN539AQdnnQYLnHURFVcX0FXVdKhljcZavmvZK0vdjf f7bz/Vm47lPahZQ0sFKlHTld2rWjorM27I61jv1Ir92CS057OcuIYDqE5GvDC37y/VZwxI +N8LMWvOl5ajuXBHlL2dyVVow71FCas= Received: by mail-wr1-f44.google.com with SMTP id j2so7367613wrh.9 for ; Sat, 18 Mar 2023 17:20:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679185216; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=oBdvoOvvbPl4lveIHMcEslRaUIrEiN+QjBIu6nhpMoI=; b=ndkKPpYK52Wx9TaYS8P3Ak2JVbZ7fg7ubv2kI2nk0dcl76gk2HKuFdmghxRMjG4hn/ /yQPyIWd/Cy5hfqB6/SYZHYeNPcpcOmBpb8/3KMNcOF2TM+5yb2GSkrWqeFE2OAu5hvT jXVo9Jsp02i1toTBMQQIEzCt7HuNSHGApAwCUX6z+Ea8l8SojMzBZiOq8m6TJ0y7R4ae 15u752TSxamf/cOyHqOjz9HdJraystALcRoZvyEiQGgqUuk+xnXwcth3zRiM2np/hzdP m+79BsOHpE8u/HcxEeEBd15l+zOfkFsiTAjL41c+6KrKxRvvCmsxYn2IO/bK40Z/5827 Prsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679185216; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oBdvoOvvbPl4lveIHMcEslRaUIrEiN+QjBIu6nhpMoI=; b=uUyGzfYpLeaFuaG/9u2sciiKbHjdzwlmpFDDeLqs5GAGLMu4PkDj1XRUW3byUtL8Es H7mrHRTMulL7djT4HcKb6c5Y3Ws2QBWm4CXLm6HC2P6J7v9evnn6z498/yZfY+FlK9D0 xIKBjUeQ/9Qbqc9plNELlF3KJfpKOh+z33TwkjQLJmwPb3N4jzFmyDxnokWUwLTG5THI T6J+OOq6c7cpYPohXFRjqlnrfz8Qdh/WvVSBWxq8RfSXpk6bo0ZxWoCL/dJBmw/V6hoX JEmXMSsdyc3zHaJ4+O1Yl0KpgRMv1GYhp8acwkMku1vpN5N8ZdqpUcTPCvrl013IRatb mQwA== X-Gm-Message-State: AO0yUKWjNw+6sfuLOWUUNMyjgNZ3VwGP5bvvwTst8/cdhidUxAuHMnSY sgUR9DXCslG2D7lD6BE9YPEft4FnSKc= X-Google-Smtp-Source: AK7set9YsshU0VAPpOI+4C85JEEyd1pQ0Y7jXTJ+bnt0arMtIaqwA6i93AcsSdqs0lXaAFCI3eV+5g== X-Received: by 2002:a05:6000:110a:b0:2ce:a93d:41a7 with SMTP id z10-20020a056000110a00b002cea93d41a7mr10132635wrw.40.1679185215658; Sat, 18 Mar 2023 17:20:15 -0700 (PDT) Received: from lucifer.home (host86-146-209-214.range86-146.btcentralplus.com. [86.146.209.214]) by smtp.googlemail.com with ESMTPSA id x14-20020adfdd8e000000b002cff0c57b98sm5399639wrl.18.2023.03.18.17.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Mar 2023 17:20:14 -0700 (PDT) From: Lorenzo Stoakes To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Andrew Morton Cc: Baoquan He , Uladzislau Rezki , Matthew Wilcox , David Hildenbrand , Liu Shixin , Jiri Olsa , Lorenzo Stoakes Subject: [PATCH 0/4] convert read_kcore(), vread() to use iterators Date: Sun, 19 Mar 2023 00:20:08 +0000 Message-Id: X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: A6B221C0012 X-Rspamd-Server: rspam01 X-Stat-Signature: fhwfhr1mpk1zj6999yto961jr8saa7r5 X-HE-Tag: 1679185217-435675 X-HE-Meta: U2FsdGVkX18QuqLLTN5Js3i/Fy73rUxcJzL74f42yo0ke7Efzzgi1/IpSIJXOyISzVswuKhIZz/93ajTbhfWonIswTmTb7ZLIqNE1Yjz9HFYQy7xtCsBVfJSCWiUiKDW2MMPQYjCpM6yJGIdjBSWgCz1h3Mudvbe+9g0Q4ua1njjUPMd35RUXCWs0VZcMmWTLnb9jG16f2lFMQ4tf4oMVh0zYxKcSrDhQX4RE/sSx19MxmX6Qqa6ej0ooyuGNDHdPyh8s5If30hWnGA66OK7V95VfQNiyKOYhN54AF/LKtTe9y2jNQh4G9t0gSKIIcMsBPYus4RYhAtOA5IijViJZFk2cckoP3bhzt98j03PGynArPxmSaSMYExq3nuS9XpEUxjuAbPfduk5/XEVfKf7Rp3b96JIrOSQG/+qOcx+XoUUJVwmoOyuUdjnExJPntepmDB/LXHJLUxo1T8kooBKA/pP0A/Mu54DFMayt0dzYGcDMudU53Dj8jY1+dwMWZ1YE+ADBajdVObZyGY2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HmblZ+mutDY8iNG2i/jG9LrO8YmD6K7 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: While reviewing Baoquan's recent changes to permit vread() access to vm_map_ram regions of vmalloc allocations, Willy pointed out [1] that it would be nice to refactor vread() as a whole, since its only user is read_kcore() and the existing form of vread() necessitates the use of a bounce buffer. This patch series does exactly that, as well as adjusting how we read the kernel text section to avoid the use of a bounce buffer in this case as well. This patch series necessarily changes the locking used in vmalloc, however tests indicate that this has very little impact on allocation performance (test results are shown in the relevant patch). This has been tested against the test case which motivated Baoquan's changes in the first place [2] which continues to function correctly, as do the vmalloc self tests. [1] https://lore.kernel.org/all/Y8WfDSRkc%2FOHP3oD@casper.infradead.org/ [2] https://lore.kernel.org/all/87ilk6gos2.fsf@oracle.com/T/#u Lorenzo Stoakes (4): fs/proc/kcore: Avoid bounce buffer for ktext data mm: vmalloc: use rwsem, mutex for vmap_area_lock and vmap_block->lock fs/proc/kcore: convert read_kcore() to read_kcore_iter() mm: vmalloc: convert vread() to vread_iter() fs/proc/kcore.c | 84 +++++++------------ include/linux/vmalloc.h | 3 +- mm/vmalloc.c | 178 +++++++++++++++++++++------------------- 3 files changed, 125 insertions(+), 140 deletions(-) --- 2.39.2