Message ID | 20230613201827.9441-4-vishal.moola@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp808002vqr; Tue, 13 Jun 2023 13:32:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6TPw0G/XdKkpaQtcUhY6pZEb9uNSa3S27AyHV4y8ciD6ItDnYF9Vn3yCVeduq2Zvx9pjnz X-Received: by 2002:a17:906:fe0c:b0:976:b93f:26db with SMTP id wy12-20020a170906fe0c00b00976b93f26dbmr12343244ejb.53.1686688370712; Tue, 13 Jun 2023 13:32:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686688370; cv=none; d=google.com; s=arc-20160816; b=R2/2U+sxyEkFhT0dCZDED8iTJjcJpR4d8UQA81ajRcBPS+6GhsQ7GhjqjJ7IHJiJru zlIJM0AIgKs2gd71LZLxdOleEDgI6VUwR7UGrZ0ReTlEgk09Kt21NOTIf4wdYUomrITe Lz3ybqDZnXdTW2B7C9jnIouhPSAde7ODs7cV/gtAX3sDkR69cegX/YdXi19CDlVZ06Be mNLsnJU0AxytHOSrjNKuuTH17W52Qe8j3uKWWLlhLajH7oz+rfPMDXn52pOK7hRWxJVT 0YrSb5zBEQrFbAXX/RAY7z+19D1z/+L7HN6V+GFPL1ydwchrxOHu1mDj8L14AH6/VifM 9kiA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bo5mmyxvl0eErY9pWIIhlP2v8r+RpR3JWxAmafCgaaA=; b=US8E9yDufRdMONsTiZ56ewuNyvH6IdGfjtDAedEreI1WG7iXp2bdn8AfsFwlu6B+po R1YmGX56UkXuIgCHlm3csdD9wfCdMxtPVybzIepW7qnlygzzzcXLlfjDVz1yCk3eqfDT cTwGLFe58fgY0uti12DZfjpl0f584agL6r3U86LATc6sRiMsbu1mgjMskBgBjXzsihGp ubyQUQ6YidGx/vHy0/W8ANoPq+7Hd/xVBCDQoxoyUTlfpnYZ15chIows27pnD4tJVFtQ f+yaSVloWT8TcVSjRbDhzvhQQ7M4vHOg70RoG4AeSiWZyb5VfWRom2Rhk1lEA9k3lD+t /bFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=mq+xPQwa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id uz25-20020a170907119900b0096a3525cb1fsi7580850ejb.166.2023.06.13.13.32.25; Tue, 13 Jun 2023 13:32:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=mq+xPQwa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240367AbjFMUT2 (ORCPT <rfc822;lekhanya01809@gmail.com> + 99 others); Tue, 13 Jun 2023 16:19:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241069AbjFMUSz (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 13 Jun 2023 16:18:55 -0400 Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAFD41BE3 for <linux-kernel@vger.kernel.org>; Tue, 13 Jun 2023 13:18:35 -0700 (PDT) Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-6b162fa87d8so3295040a34.3 for <linux-kernel@vger.kernel.org>; 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=Lolkin1mDHciPFzWyWXAC7sd801C/On5Pi+TcsiFOiY0mW9dHAkwtWuSNTf1Gea23v 93PjWLviBUTz8fEe7pVLUsthgTjOFNacMXaV+rIw8N69PL8A1Z/fFNvDqi42HjmoePUX BGVCuZIASoFgq9qCy5+ouSzuLMCf2ToyQVdr8mGKSeJee9cGvlHbwMw/eLC+PvCNVVmH 2yR3KkxIais1FnCal2AK9mfMXhEqYtdLtYz6iKNYumiI3yvHdp5d8Qo0Ng+b92RCQB20 s9U2QXypyz7MjhbrsRej6PEwq3zCn25o2F2PBEwhFz8r8RO/45b0mxPtlwpK4se/hBvf 6PPQ== X-Gm-Message-State: AC+VfDzV9R5acNwr/6V2vIZt27mqKkiAKw6itkq5VbjfiiWamnz+4GVO NI15F3HjLrBfCwkFX4xEJZg= 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)" <vishal.moola@gmail.com> To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Vishal Moola (Oracle)" <vishal.moola@gmail.com> 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768620945301681679?= X-GMAIL-MSGID: =?utf-8?q?1768620945301681679?= |
Series |
Replace is_longterm_pinnable_page()
|
|
Commit Message
Vishal Moola
June 13, 2023, 8:18 p.m. UTC
verify_dma_pinned() checks that pages are dma-pinned. We can convert
this to use folios.
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
---
mm/gup_test.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
Comments
On Tue, Jun 13, 2023 at 01:18:25PM -0700, Vishal Moola (Oracle) wrote: > verify_dma_pinned() checks that pages are dma-pinned. We can convert > this to use folios. > > Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
On Tue, 13 Jun 2023 at 21:18, Vishal Moola (Oracle) <vishal.moola@gmail.com> wrote: > > verify_dma_pinned() checks that pages are dma-pinned. We can convert > this to use folios. > > Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> > --- > 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; > } > } > -- > 2.40.1 > > (Hope you don't mind me taking a look, GUP is of interest to me :) Reviewed-by: Lorenzo Stoakes <lstoakes@gmail.com>
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; } }