From patchwork Wed Jul 12 14:38:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 119218 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1191088vqm; Wed, 12 Jul 2023 07:30:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlFHu69pzgza27vG51u8HiB9CZYCiGyMgGHZh5QfO6k7wj9mX/BIdQKptFNFfjmoc8bNinGL X-Received: by 2002:a17:906:20d7:b0:993:ec0b:1a21 with SMTP id c23-20020a17090620d700b00993ec0b1a21mr14076083ejc.27.1689172218540; Wed, 12 Jul 2023 07:30:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689172218; cv=none; d=google.com; s=arc-20160816; b=CvUF5DouW/NzbBiSasRB/DXnXZVPVhXbj7wCrsXtGKM+t7cxPgHH6KAgdZFhcefsiX FeG0mgWGDgMYUHgD7NEHl9FLNU2Xn5xU7RNGdqsZ9AFuKxoOVnSQbcIJV/MlTOGuCtMk Sb/3KTH0R1hWgoZByKx5pgmbGE83Du4X6qCtvLCOHENUInlKRWkeF2SLiqciwvwet5pY 7zLjCb5pULG7/JkE4JxgBRdUKrmcKXWWOT5941dtBAxMEwfr7Nt/Ufew1Cy2qGXiL2e1 ckpmI4q9/ylE1LFIqM1lFt4Ly6u3qYrTSpbunER5AL3uztxNlufJRj9zbqduzyg1sJKn e2pg== 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; bh=ETNPB7wUh0SNwnx9DDYb/PlWZoZqHTNfB+0DsPV8JQI=; fh=FRon72YwFeIVU/LlfmPNxuVFiduvQKfa+Ydvnh8xLfc=; b=qnP0IK0NqCwUsOUCWLnBWuFoibAywwlQb2yxwn6at6tuesEKYjAC1w7CKKYlDhF7L1 hDmIU8nN1eNfQokFAf20OiwqN26WwBAax9uksryZyZ27IvSyCLXb0aQ1hrp1YMwoIIwS ftBsQ9dqmolLus9gyjBTV3drE1WASgJSsmeOEO2SFr7L9+pG+8ZqL0YPAubRIYdPu4jf eolntYaww4hUKosyzCA67ZzdPKuh5OXvhCyemS/0/Yg45JeqY3JaQv1jUDTJsQwXNzgp /0xAJj+gLFctYkECa/V4lpRie1nP9PP/+ynYdzUzZOscAkSTg465l/rRn4UFOpKSD74v Em5g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd1-20020a170906ce2100b00988a83822d8si4781865ejb.938.2023.07.12.07.29.53; Wed, 12 Jul 2023 07:30:18 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232606AbjGLOZe (ORCPT + 99 others); Wed, 12 Jul 2023 10:25:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232441AbjGLOZW (ORCPT ); Wed, 12 Jul 2023 10:25:22 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6D491BC6; Wed, 12 Jul 2023 07:25:17 -0700 (PDT) Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R1Kkb0rdCz1JCP8; Wed, 12 Jul 2023 22:24:39 +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, 12 Jul 2023 22:25:13 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , , , Kefeng Wang Subject: [PATCH 3/5] drm/amdkfd: use vma_is_stack() and vma_is_heap() Date: Wed, 12 Jul 2023 22:38:29 +0800 Message-ID: <20230712143831.120701-4-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230712143831.120701-1-wangkefeng.wang@huawei.com> References: <20230712143831.120701-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771225448275128502 X-GMAIL-MSGID: 1771225448275128502 Use the helpers to simplify code. Signed-off-by: Kefeng Wang --- 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 479c4f66afa7..19ce68a7e1a8 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c @@ -2623,10 +2623,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_heap(vma) || vma_is_stack(vma); start_limit = max(vma->vm_start >> PAGE_SHIFT, (unsigned long)ALIGN_DOWN(addr, 2UL << 8));