From patchwork Fri Mar 20 16:49:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 11449855 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 952FA17E6 for ; Fri, 20 Mar 2020 16:50:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6240020739 for ; Fri, 20 Mar 2020 16:50:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="UicuVQOU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6240020739 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F0D666B000A; Fri, 20 Mar 2020 12:50:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E46776B000D; Fri, 20 Mar 2020 12:50:26 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE5B86B000E; Fri, 20 Mar 2020 12:50:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0221.hostedemail.com [216.40.44.221]) by kanga.kvack.org (Postfix) with ESMTP id B14916B000A for ; Fri, 20 Mar 2020 12:50:26 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 38E10181AEF00 for ; Fri, 20 Mar 2020 16:50:26 +0000 (UTC) X-FDA: 76616328852.16.beast16_3c2d33891056 X-Spam-Summary: 2,0,0,f275ba00c90c6b5f,d41d8cd98f00b204,jgg@ziepe.ca,,RULES_HIT:41:69:355:379:541:800:960:968:973:988:989:1260:1311:1314:1345:1359:1437:1515:1535:1544:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3355:3865:3866:3867:3868:3870:3871:3872:3874:4118:4250:4321:4418:4605:5007:6117:6119:6120:6261:6653:7576:7875:7901:7903:9010:9036:9592:10004:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:12683:12895:13894:14110:14181:14394:14721:21080:21325:21444:21451:21627:21990:30003:30012:30045:30054:30070,0,RBL:209.85.222.195:@ziepe.ca:.lbl8.mailshell.net-66.100.201.201 62.2.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: beast16_3c2d33891056 X-Filterd-Recvd-Size: 7319 Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Fri, 20 Mar 2020 16:50:25 +0000 (UTC) Received: by mail-qk1-f195.google.com with SMTP id q188so2227538qke.8 for ; Fri, 20 Mar 2020 09:50:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J9JcxoC0xHItzd7Bm+/rd4h3D6gYeCH34NADuZJ9STU=; b=UicuVQOUEOFXjcAue0sr6wmiMWeQXUmp/+3fIH5Zf7ToFdz2MJUF/GwaQV0CfokeCb R2ZYWS8t6p3i85jB4vGXhW7eauCyoXDMnLR5bqGUsHf6p7MUJiRrBD7IoIVVEIB4rwuA y7Ou48uJJJSNcpH0D02oeN5/knSWGgZa6OE2WopCjZyKOqlXD1J4bWaHUAy88Hi+g7z4 OQy9KADO+sZIv3HZ5Z5kH4FLvXskp7bNMpRHHZ5+zSKF0JlEddd3Ns59vClO3DaXjZ4u SHP/vweGSCa3pfVODg70IS9UBVRTZnSNlDoLy3DvscRGxnThtEJy7i8cblj+pDVJdQlx F1fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J9JcxoC0xHItzd7Bm+/rd4h3D6gYeCH34NADuZJ9STU=; b=asrsFF/CIEtaL7IpZ2m2wKxgOUkTb4k2hxENhJrG3lwk0JrDQbIRzRlh/sVR9HLT5o b7e2LB0wTJhUN8l5laT4jYya1ptzAIFFoaryBcAQh59VW1UsrNfXWuF1i5kcxUui8dW4 HswHInZ910yTPuqxFbEBhS0kJEh/FDBxUuDmAtmh4fnue3cDWtw1oCuXKK2pBWkbwcRH P0xD7bOv5VQKwfGW4iVKmVlsPCwP27pbGY4ainzTG/42cXScCyMdHxAbDqELQwlo/9CU mjRuxsNV1wGyUYSsy7QBrNk9si0N4Ayp+LzS5CF5GpuEaYeG9mdWUEuKNA5MfzaK3Qq7 B+ig== X-Gm-Message-State: ANhLgQ0mzPC2776sVleqSDstKhZF+dMWSjWVrje2VOrkboVEpQ5s2112 CyOXxiP0HUuVmcJJ1iG6Ppt56w== X-Google-Smtp-Source: ADFU+vtuzdu+L+cKseNEMu1uY1fgXL01MDSyACtZa/2w0baVgXDZzqzudj1Yb+oXFP4S8/aXJlsNnQ== X-Received: by 2002:a37:9544:: with SMTP id x65mr8264783qkd.48.1584723025227; Fri, 20 Mar 2020 09:50:25 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-57-212.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.57.212]) by smtp.gmail.com with ESMTPSA id z11sm4894505qti.23.2020.03.20.09.50.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Mar 2020 09:50:24 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1jFKql-0005kC-9J; Fri, 20 Mar 2020 13:50:23 -0300 From: Jason Gunthorpe To: Jerome Glisse , Ralph Campbell , Felix.Kuehling@amd.com Cc: linux-mm@kvack.org, John Hubbard , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Christoph Hellwig , Philip Yang , Jason Gunthorpe Subject: [PATCH hmm 3/6] mm/hmm: remove unused code and tidy comments Date: Fri, 20 Mar 2020 13:49:02 -0300 Message-Id: <20200320164905.21722-4-jgg@ziepe.ca> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200320164905.21722-1-jgg@ziepe.ca> References: <20200320164905.21722-1-jgg@ziepe.ca> MIME-Version: 1.0 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: From: Jason Gunthorpe Delete several functions that are never called, fix some desync between comments and structure content, remove an unused ret, and move one function only used by hmm.c into hmm.c Signed-off-by: Jason Gunthorpe Reviewed-by: Ralph Campbell Signed-off-by: Christoph Hellwig --- include/linux/hmm.h | 50 --------------------------------------------- mm/hmm.c | 12 +++++++++++ 2 files changed, 12 insertions(+), 50 deletions(-) diff --git a/include/linux/hmm.h b/include/linux/hmm.h index bb6be4428633a8..184a8633260f9d 100644 --- a/include/linux/hmm.h +++ b/include/linux/hmm.h @@ -120,9 +120,6 @@ enum hmm_pfn_value_e { * * @notifier: a mmu_interval_notifier that includes the start/end * @notifier_seq: result of mmu_interval_read_begin() - * @hmm: the core HMM structure this range is active against - * @vma: the vm area struct for the range - * @list: all range lock are on a list * @start: range virtual start address (inclusive) * @end: range virtual end address (exclusive) * @pfns: array of pfns (big enough for the range) @@ -131,7 +128,6 @@ enum hmm_pfn_value_e { * @default_flags: default flags for the range (write, read, ... see hmm doc) * @pfn_flags_mask: allows to mask pfn flags so that only default_flags matter * @pfn_shifts: pfn shift value (should be <= PAGE_SHIFT) - * @valid: pfns array did not change since it has been fill by an HMM function * @dev_private_owner: owner of device private pages */ struct hmm_range { @@ -171,52 +167,6 @@ static inline struct page *hmm_device_entry_to_page(const struct hmm_range *rang return pfn_to_page(entry >> range->pfn_shift); } -/* - * hmm_device_entry_to_pfn() - return pfn value store in a device entry - * @range: range use to decode device entry value - * @entry: device entry to extract pfn from - * Return: pfn value if device entry is valid, -1UL otherwise - */ -static inline unsigned long -hmm_device_entry_to_pfn(const struct hmm_range *range, uint64_t pfn) -{ - if (pfn == range->values[HMM_PFN_NONE]) - return -1UL; - if (pfn == range->values[HMM_PFN_ERROR]) - return -1UL; - if (pfn == range->values[HMM_PFN_SPECIAL]) - return -1UL; - if (!(pfn & range->flags[HMM_PFN_VALID])) - return -1UL; - return (pfn >> range->pfn_shift); -} - -/* - * hmm_device_entry_from_page() - create a valid device entry for a page - * @range: range use to encode HMM pfn value - * @page: page for which to create the device entry - * Return: valid device entry for the page - */ -static inline uint64_t hmm_device_entry_from_page(const struct hmm_range *range, - struct page *page) -{ - return (page_to_pfn(page) << range->pfn_shift) | - range->flags[HMM_PFN_VALID]; -} - -/* - * hmm_device_entry_from_pfn() - create a valid device entry value from pfn - * @range: range use to encode HMM pfn value - * @pfn: pfn value for which to create the device entry - * Return: valid device entry for the pfn - */ -static inline uint64_t hmm_device_entry_from_pfn(const struct hmm_range *range, - unsigned long pfn) -{ - return (pfn << range->pfn_shift) | - range->flags[HMM_PFN_VALID]; -} - /* Don't fault in missing PTEs, just snapshot the current state. */ #define HMM_FAULT_SNAPSHOT (1 << 1) diff --git a/mm/hmm.c b/mm/hmm.c index b4f662eadb7a7c..687d21c675ee60 100644 --- a/mm/hmm.c +++ b/mm/hmm.c @@ -37,6 +37,18 @@ enum { NEED_WRITE_FAULT = 1 << 1, }; +/* + * hmm_device_entry_from_pfn() - create a valid device entry value from pfn + * @range: range use to encode HMM pfn value + * @pfn: pfn value for which to create the device entry + * Return: valid device entry for the pfn + */ +static uint64_t hmm_device_entry_from_pfn(const struct hmm_range *range, + unsigned long pfn) +{ + return (pfn << range->pfn_shift) | range->flags[HMM_PFN_VALID]; +} + static int hmm_pfns_fill(unsigned long addr, unsigned long end, struct hmm_range *range, enum hmm_pfn_value_e value) {