From patchwork Thu Sep 5 15:30:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nanyong Sun X-Patchwork-Id: 13792621 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 5078DCD5BCB for ; Thu, 5 Sep 2024 15:31:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D32B46B0088; Thu, 5 Sep 2024 11:31:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CBB8F6B0089; Thu, 5 Sep 2024 11:31:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B5C296B008A; Thu, 5 Sep 2024 11:31:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 96FFE6B0088 for ; Thu, 5 Sep 2024 11:31:45 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 46CEDA90FC for ; Thu, 5 Sep 2024 15:31:45 +0000 (UTC) X-FDA: 82531074570.21.58F7CB4 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf23.hostedemail.com (Postfix) with ESMTP id D4BCB140009 for ; Thu, 5 Sep 2024 15:31:42 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of sunnanyong@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=sunnanyong@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=1725550278; 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: references; bh=GIU8QudKOVgIBMq2YWrFArgNx9Qtq2hl1DdpeQctJ/U=; b=h64sRxQm9ljcadJm+EBEP0L79QSoEoUg9+7yQIAGxQ18MCOUkBGO0xora/U/8c5f4NO8M1 5BmvPBBqmfy/X94PJFlPF0DiaiXjwIH1vgjiXjXshV/WwuIq0hkEnB+/08ebJDF46nSxZk 0USqhALNrGoTXh4OYQUZClUPlCqK4oQ= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of sunnanyong@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=sunnanyong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725550278; a=rsa-sha256; cv=none; b=QJnj/GXZon42EXBGmHO8X2x6BuRiiuNZDkZffL4PmfuPjcseAQbM9ao6lhrzor2ek1t8Qd 5RNxnEfMM1Lf98bHsOnJdbtS0uup6IO8QTBMq0t36KNUWkhJHA6ij3xH5xbHnq7e2KecpL 3mdu2fW9j6J+QXxHK+3aPOnFVCGto9I= Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4X03Gq3qvbzyRWB; Thu, 5 Sep 2024 23:30:59 +0800 (CST) Received: from kwepemm600003.china.huawei.com (unknown [7.193.23.202]) by mail.maildlp.com (Postfix) with ESMTPS id DDEA818006C; Thu, 5 Sep 2024 23:31:38 +0800 (CST) Received: from huawei.com (10.175.124.71) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 5 Sep 2024 23:31:38 +0800 From: Nanyong Sun To: CC: , , , Subject: [PATCH] mm: thp: simplify split_huge_pages_pid() Date: Thu, 5 Sep 2024 23:30:28 +0800 Message-ID: <20240905153028.1205128-1-sunnanyong@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-Originating-IP: [10.175.124.71] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600003.china.huawei.com (7.193.23.202) X-Rspam-User: X-Stat-Signature: ufb1tb5arbd4tpez7few84m9wss4miub X-Rspamd-Queue-Id: D4BCB140009 X-Rspamd-Server: rspam11 X-HE-Tag: 1725550302-378533 X-HE-Meta: U2FsdGVkX19DWthTW+dXg8jYtelaq5wJ31sqCpSn4HSOE2eTE8gvfEwLAe7wdu+B8raKVHWs8jxk/nuD4lubL9RKwK3Nf61K4iGr9h5LZ2nN31W7Xvc/8+TkCl8G9CTeUPBGDjOz1FSpYnq0TUcNO3RFOm5vAb02bna/OivUdmyVJyyBD5JhRpumbpva3Pllh5yJj/AJzxu9mnsbtr98+S+AhP8Mugfc5yUOVj+7C3y/5ocC7luEaB45zefHP59uscsoQbQdSmjL6+dPRjO/uKLasxN3USKqgHJBvmRsVF44LDzehfiXKyGIaQtuO31bNKh02mayue0FcTFk4yHQLFzymaOoz8PoUr1ZKVKzcuV7M5CDj+lXdO9Ua37wl2wnj8Qei2A8DnHLDSlU14uNw7g3U9Agu5/1m2aKL5ubZf7S+55jsbAN7u7zFzOO6YxXBSalGQQC9BMtyBUWTPVGLFpBjtb8TaSOcSPrq7Ar+kJVAWw1YiSVw1DLxu2Q+0MDT/kDl+s4CeKJ37NFqtvtof1WO1k53NbbD4G9N4pjFWUsyWifLLv4/DihIeUWlxedLpoMVmspzeuxazGl6OqVkIP+bZVSe7nk9OnibfbkbW/m1g2uwXi0bNWwMz5Gx9oVni43MlBUgBIaPP5eBrInI99/lXAXbhhx6zHs9IjxlfNDPBxrJqu/2zqlps7G5mYIgmLvDxYBQQlomoBS6ITteBTINq0HZh3neLE4ghh8zKZyswe45yciX4w//o5b2yP75MHc4u5my/+tlYgpxCUmE9F2KR/2cU1KZZ0upYGtlFG3gbNFlMo+htwnRuS5vvezeSM3Y9CKe5vRbPmX52mPkWBF/qSd6tzUquRFFnpHOq+JpG017QngqaICa77hCKRhDlV3aFSzC+4URfnxnkDSIYA+BS26CSKOEUViSO71cdGrTe1ZzVhutD0TJ7O/ZCj2sI0RVhGA2cWZTI/cjFM AIa4+wdR rr/Vn/vVFngk6T4PrnpWr90M0Ny1thvV7mxgFfZUu8LtlW4ocDTIx53ge2xDvIIty2Gvdkojt+LnC/gpruj1jonLeZjXjSERTMntEx9vxnayX7g0w6az/fmggIP13JkwqR10j7ZIqANKjAofe29Qcqi0YPhGqEjNJiw7yjGoSYyTg1RXwG9zFPXKpi7DnXiThXwA8 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000006, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The helper find_get_task_by_vpid() can totally replace the task_struct find logic in split_huge_pages_pid(), so use it to simplify the code. Also delete the needless comments for the helper function name already explains what it's doing here. Signed-off-by: Nanyong Sun --- mm/huge_memory.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 67c86a5d64a6..c5349c2a8275 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3480,16 +3480,11 @@ static int split_huge_pages_pid(int pid, unsigned long vaddr_start, vaddr_start &= PAGE_MASK; vaddr_end &= PAGE_MASK; - /* Find the task_struct from pid */ - rcu_read_lock(); - task = find_task_by_vpid(pid); + task = find_get_task_by_vpid(pid); if (!task) { - rcu_read_unlock(); ret = -ESRCH; goto out; } - get_task_struct(task); - rcu_read_unlock(); /* Find the mm_struct */ mm = get_task_mm(task);