From patchwork Wed Jul 19 07:51:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13318462 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 7F956C001DC for ; Wed, 19 Jul 2023 07:40:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B7517280034; Wed, 19 Jul 2023 03:40:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AFDE48D0012; Wed, 19 Jul 2023 03:40:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 97724280034; Wed, 19 Jul 2023 03:40:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 80D598D004B for ; Wed, 19 Jul 2023 03:40:11 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 594BD80113 for ; Wed, 19 Jul 2023 07:40:11 +0000 (UTC) X-FDA: 81027563022.02.D9C35CF Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf11.hostedemail.com (Postfix) with ESMTP id 724C440007 for ; Wed, 19 Jul 2023 07:40:08 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689752409; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=24vgN4qXgyyKOnmcSjRBoNWV8I6xDWypWU2tuXRGxGw=; b=VXJ2p/NMQzM11qB43Nz+ryLzTS1wpnkUt0MnPhRTXIHn7O1j/eHACDFNkSG9ZVKU7tXQPR 7Z8Pk0Q+4MRm08EQCHH8Wjoy6NjkFPUJ5hoNGLjOpIRDNmvNI8ULpftvhGW+2ZKprchIKh pBXnP2yxSAtOiK+TGzoAldxt8JCBcVQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689752409; a=rsa-sha256; cv=none; b=Nt7a7nithSFAeKix/Sz3V0Cv3QNbEnKqd1pkFyinLZnJi4/dCb6vLiWf5X2seI3VqjWc6W 8zJUlOXq6KgSkycowbS6pyGdl3CT/WUTVJ8rRoncJntFKnf+zKotoyle9beN14hbjF2s9k 5vBPrNAUsjACWrhyd43z4GAmCIAwWlM= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R5SMh4XL3zLns5; Wed, 19 Jul 2023 15:37:36 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Wed, 19 Jul 2023 15:40:03 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , , , Kefeng Wang , Felix Kuehling , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter Subject: [PATCH v2 2/4] drm/amdkfd: use vma_is_initial_stack() and vma_is_initial_heap() Date: Wed, 19 Jul 2023 15:51:12 +0800 Message-ID: <20230719075127.47736-3-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230719075127.47736-1-wangkefeng.wang@huawei.com> References: <20230719075127.47736-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 724C440007 X-Rspam-User: X-Stat-Signature: phou8ppkngu83k9iyddsqxopt5a9cj1k X-Rspamd-Server: rspam03 X-HE-Tag: 1689752408-194900 X-HE-Meta: U2FsdGVkX1/qLDfKVh72RPTQv/NN9YQSgjzLAfWHI8o23e+w111qh8Xeys6jhWMz7cb/Lcz3HJVsAHJdVLj90H0NtIfyN5EqD+lflVg8NLauhpt7gpzQLvp+oatQGpHILmn+32XvqH9XMbcJ7mG3K8S9ozeIkTiwwpYQwvzDdrr5GxGp5kYBmd3p+t2e+FdXtmdJ28n/QNq59x89zuOu1o/Inp2c/oU9S+btq19q98ISDUgsonB11hQxEEeNuzByRwBXGUqP1jrrjQyQd6xyaZDMf/rih5smcm0sVbof1E5rri0JXWhqGIc+3MhUnHGAytwQpvlPAEqZGFqZznB3dBbWZ4LMZRjOJWhnr977TShD1Lek4KTe3EybTk3VtHn6rE1gv/P5RhU3avMjrJdd1ECnSyMLJtbUolbf4CXYBxdzHC8JJ+1++hSOVc6GM9Z+xB4afsQekfOA0jIZ4xxqecQhz5X/E98iyN8Jyi9Zb+fFXJiuDMuIJAHaRNLOa+zxRwVvCsrEEU00ueh88OQIZyfbd74F7KiD7i44a0bOq+IDIsPa0Cc83qg8wVT17jVnRQ8jDb9mIH103QqQhYAoCR6EnDsdKwYZzZxEx6qgckSSrfY+Q5Zh2ru07CRgyJkSRDMk12SZQpZ0MZq1/LJanS0PLx7LLLNSa7oujOH9TJuJx2IbYLt/y3G9qCj5LbCd0j1lDQcoDbJqZlZ/haz3m69oDnzFGxKXGavl7E3h5jkZwzMDzEjFCTK5SS/C1wNKWrw8wk+SbFarlECDWGr8w12ikOTku8fwLrtb6MxfHssMQjpCslVSIDxlVMAPKyo9/anSAK8jC+SiCQjOSMUmytgMUx6fih2Gk6Gx53aZmvNRLd8nbFJcIDzJHYEwNzH0/ybMWS7yW3HfIEHLM7mym8/xQa7KETALyblkbNUGafjch8VXpd1TnOYLeLYtRgbXEqdkWenvhiuzrDsnF4Q il0/M9nQ g03xVHx4rx9JTJF4sJpI+tSRj+8zfKFUCdELLPdbg46AaayMSaLyD2/8xQRfNWmbcX0ejHYnh9XoZmndx9IOIOtpnwbd/0MbOg+usb5erhmDFMuZDsqOV1kMx7Z8vfzwAadRPZD0UCVu2AerqcehEWhxTS6nVeUImn9T7MU+5pizhcTFH4FRLAMWgmXWnZAqEIDUgPRGEFi4hIQFSEe05B7rZt3YhGM5Gwa/ZbqZSlwHD1iQS77e31pZl6md9tDLw/eQT 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: Use the helpers to simplify code. Cc: Felix Kuehling Cc: Alex Deucher Cc: "Christian König" Cc: "Pan, Xinhui" Cc: David Airlie Cc: Daniel Vetter Signed-off-by: Kefeng Wang Reviewed-by: David Hildenbrand Reviewed-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c index 5ff1a5a89d96..0b7bfbd0cb66 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c @@ -2621,10 +2621,7 @@ svm_range_get_range_boundaries(struct kfd_process *p, int64_t addr, return -EFAULT; } - *is_heap_stack = (vma->vm_start <= vma->vm_mm->brk && - vma->vm_end >= vma->vm_mm->start_brk) || - (vma->vm_start <= vma->vm_mm->start_stack && - vma->vm_end >= vma->vm_mm->start_stack); + *is_heap_stack = vma_is_initial_heap(vma) || vma_is_initial_stack(vma); start_limit = max(vma->vm_start >> PAGE_SHIFT, (unsigned long)ALIGN_DOWN(addr, 2UL << 8));