From patchwork Tue Jun 13 20:18:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13279174 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 98CD4EB64D8 for ; Tue, 13 Jun 2023 20:18:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F9006B007E; Tue, 13 Jun 2023 16:18:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 45B868E0002; Tue, 13 Jun 2023 16:18:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2ADAC6B0081; Tue, 13 Jun 2023 16:18:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 1ABCB6B007E for ; Tue, 13 Jun 2023 16:18:38 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id EFCC11405F3 for ; Tue, 13 Jun 2023 20:18:37 +0000 (UTC) X-FDA: 80898837474.06.677EECB Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) by imf05.hostedemail.com (Postfix) with ESMTP id 1AC84100015 for ; Tue, 13 Jun 2023 20:18:35 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=mq+xPQwa; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.52 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686687516; a=rsa-sha256; cv=none; b=K+hVy+EhNNxKg6cTEtsUIwP45vDXbDKgrRSt6RUoCxlKkP6jZ4apX4W6hZMDCriUkXChfa DIAW8Z+OvwhQuKDIDlmk3CnoJEZEwM6bTRu31Ij6bZl+3KrHuA10tVeZ0QXrJRJIrWTv52 oxrqKFw/pZ5/+SFaxEhw/MBTg80rJGc= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=mq+xPQwa; spf=pass (imf05.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.210.52 as permitted sender) smtp.mailfrom=vishal.moola@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=1686687516; 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:in-reply-to:references:references:dkim-signature; bh=bo5mmyxvl0eErY9pWIIhlP2v8r+RpR3JWxAmafCgaaA=; b=K9ajAd6OhkEhl0ZE1H1do++aElHNiP+vMJwVyIcVCTagH/nmnXXg8PoPB4VSjc2EMOa9iX 82M5E/iMzCDr8Pwm7HPd7e7qPySA/UNDVEiVmw9FApVZOxk6ht/U3evniVAH0Z2giAS3Qx MA2Xf2VcIedf1v0LU/l8QEX9R6B2O7g= Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-6b2d356530eso2778647a34.0 for ; Tue, 13 Jun 2023 13:18:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686687515; x=1689279515; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bo5mmyxvl0eErY9pWIIhlP2v8r+RpR3JWxAmafCgaaA=; b=mq+xPQwaOKwXksJ8eIOgdN3s569QJ0hElDZw9QHnYu3dnpIe0Od4y3M6EvPuXCbYcW 0PCN59K8kIoHsrBj9GKTgCoqWqxEo1BJpDu82hVYNvrIXokkvOlwvl6qRQC8sus+P6g/ ezx6HULqCegZHyQwScdJYf7E+SlqcD6XLy/1xMzHxMinGkOLKi01dQe2/NKQO/hJPRPj oH1arSzrLT6pfQ73f4Ay/jE7vGARCFLtpJMd3sSd8TNqL4owBma2eW+iaryCuuvtKVib GFPFMn5bRjH7YA5iJyJT7x6df7yBL/bNziEY1Jv8CK+8aC+6sK6L5ZgtrbGx/ClhN8vr 6Q5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686687515; x=1689279515; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bo5mmyxvl0eErY9pWIIhlP2v8r+RpR3JWxAmafCgaaA=; b=OZYrvGUd4PYrX4Qw3nN5HRKmOYr0rQKY3UxYXIZ7pQkIzgq/g/ap5fDlrCqzqdeVMu lShvnJv2DPaniQ+mEKWjJ3h8v0bPUsOHSj+KSlHAMWeqb1aDx2HLC7NchyeBM+Nlca+K B/7xxRjx4gRmVvi2CvfEkrwaIPtLhXp43puvxN3lox3GuYOkFPyHRuR9Nr1kw00UJ+FD 6jlJFzI/4pa1RhDiesBMyqFlGbP4t53tFnOc9aRCPeeRPTxOE3/xYLRtinRESNSnocPs zgmfjkeqatYImlDnOXn1rWjWY73OBMwUg3lgCrzkYI8qN617KpYsd6gge+BaIXdN9vMs J2hw== X-Gm-Message-State: AC+VfDzsw12p5B81+ar8iO8R3odAC2/aoNG24n9mZEwJxwXYftmX0hKV pqD8qRM/aNKcVTd8MiSNtJE= X-Google-Smtp-Source: ACHHUZ4A3AFdIj6lVST9fewNM+pv7wUenff8RHRSL727C8ic8PZIP1u1DM/DgsJ4NorS0Iqg0KUB7g== X-Received: by 2002:a05:6358:9dac:b0:129:cf11:6b2a with SMTP id d44-20020a0563589dac00b00129cf116b2amr3722960rwo.3.1686687514875; Tue, 13 Jun 2023 13:18:34 -0700 (PDT) Received: from unknowna0e70b2ca394.attlocal.net ([2600:1700:2f7d:1800::e]) by smtp.googlemail.com with ESMTPSA id b72-20020a0dd94b000000b0056cea0480c6sm2509985ywe.2.2023.06.13.13.18.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 13:18:34 -0700 (PDT) From: "Vishal Moola (Oracle)" To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH 3/5] mm/gup_test.c: Convert verify_dma_pinned() to us folios Date: Tue, 13 Jun 2023 13:18:25 -0700 Message-Id: <20230613201827.9441-4-vishal.moola@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230613201827.9441-1-vishal.moola@gmail.com> References: <20230613201827.9441-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 1AC84100015 X-Stat-Signature: npg3fzwf6bcp9upmz85zzozr8suhso56 X-Rspam-User: X-HE-Tag: 1686687515-754755 X-HE-Meta: U2FsdGVkX1+bUKvFnqH1iwMcBFJLcRsd/as+oMyyMk4NsAkcz0raBgN0Z2cBR6HP0dOoVp75tNOpmNbhHxTt8tABOkpQbCfqrm+/i6LC5QUIg9YgIqKaGLQSkQ3S14VcKDac6/8z/1UuYQvsFXk+qiynZP25NaYUjWT/FWwBNQTfl2TjrdskzKp0YS3XnDgNOta/vlrgTRQIpXQKkROKF2Pji2nI4FHiihlvyhBKjj6pWbwq39k5r+G9E8dAQLigVgQufhBVptc8IncARxc/FaaWBOwcuG7kp3tFErCn1/5GveNG2Ubl1DTywh0tPTGA40zCd4ZTYHxLCPwj8PED6g4RnSyy3tmGrRhLrvebaqnDpa7hUSWHYfaMJkjT5QmU09Hl3CUqwh9xlB8/y0cjTcHGgiKAsOd1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pvwoQkutOnANxvkgkWv+XTsF1ZVUdj78fa5VWgbdTYvP6g4Kli1kDR4NHVcfP+gM0VZsGaWi//njWgm2axutFcelrC20n+uohZU= 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: verify_dma_pinned() checks that pages are dma-pinned. We can convert this to use folios. Signed-off-by: Vishal Moola (Oracle) Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: Lorenzo Stoakes --- mm/gup_test.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/gup_test.c b/mm/gup_test.c index 8ae7307a1bb6..860b093b4b3e 100644 --- a/mm/gup_test.c +++ b/mm/gup_test.c @@ -40,24 +40,25 @@ static void verify_dma_pinned(unsigned int cmd, struct page **pages, unsigned long nr_pages) { unsigned long i; - struct page *page; + struct folio *folio; switch (cmd) { case PIN_FAST_BENCHMARK: case PIN_BASIC_TEST: case PIN_LONGTERM_BENCHMARK: for (i = 0; i < nr_pages; i++) { - page = pages[i]; - if (WARN(!page_maybe_dma_pinned(page), + folio = page_folio(pages[i]); + + if (WARN(!folio_maybe_dma_pinned(folio), "pages[%lu] is NOT dma-pinned\n", i)) { - dump_page(page, "gup_test failure"); + dump_page(&folio->page, "gup_test failure"); break; } else if (cmd == PIN_LONGTERM_BENCHMARK && - WARN(!is_longterm_pinnable_page(page), + WARN(!folio_is_longterm_pinnable(folio), "pages[%lu] is NOT pinnable but pinned\n", i)) { - dump_page(page, "gup_test failure"); + dump_page(&folio->page, "gup_test failure"); break; } }