Message ID | 20230906124234.134200-3-wangkefeng.wang@huawei.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 B6794EB8FB8 for <linux-mm@archiver.kernel.org>; Wed, 6 Sep 2023 12:32:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 58867440167; Wed, 6 Sep 2023 08:32:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 53781440151; Wed, 6 Sep 2023 08:32:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 426B8440167; Wed, 6 Sep 2023 08:32:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 33BB9440151 for <linux-mm@kvack.org>; Wed, 6 Sep 2023 08:32:33 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 06A9840B03 for <linux-mm@kvack.org>; Wed, 6 Sep 2023 12:32:33 +0000 (UTC) X-FDA: 81206110986.16.8C1B5E4 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf07.hostedemail.com (Postfix) with ESMTP id 93E5040028 for <linux-mm@kvack.org>; Wed, 6 Sep 2023 12:32:29 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=none; spf=pass (imf07.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 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=1694003551; 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=AX+U74nr5Le0KVgJkSOr8aMz7KHIoSPWgWf306Yi4XU=; b=wSI+sUPpVbpKlQdOMcXQNryhQIVLJz84QwAtbZ0UVVl3fzntzrmi/ruP72Xct3YxJPbRuc hnJt1ebOffQdG+wdFhqQEZmTfz5pLURCZmWR1Gw4tz5Mrq2ZJ7yOgZ3xSxJQUisyHcYpZA ImTbHZKR+LXMbzIyQjWzwqOVsRyxVi0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694003551; a=rsa-sha256; cv=none; b=3j6ats1tRDEjdBnx+icd6hrICK4YRZPQAp66kMh14VfbRzZvaPi4Pa7KC6bN6ZDD93tMXU hBEOQQV9VelK6UlHv9YV+hf50/fAJbUkG4CCkR+azHLmrXAERAMsFsQbwMfQPldEfWbZnu 7pA4L1hxp6Vzvx7jgccdNHP1lumkLFY= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; spf=pass (imf07.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RghXr5F7rz1M96W; Wed, 6 Sep 2023 20:30:20 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 6 Sep 2023 20:32:07 +0800 From: Kefeng Wang <wangkefeng.wang@huawei.com> To: Andrey Ryabinin <ryabinin.a.a@gmail.com>, Alexander Potapenko <glider@google.com>, Andrey Konovalov <andreyknvl@gmail.com>, Dmitry Vyukov <dvyukov@google.com>, Vincenzo Frascino <vincenzo.frascino@arm.com>, Andrew Morton <akpm@linux-foundation.org>, Uladzislau Rezki <urezki@gmail.com>, Christoph Hellwig <hch@infradead.org>, Lorenzo Stoakes <lstoakes@gmail.com>, <kasan-dev@googlegroups.com>, <linux-mm@kvack.org> CC: Kefeng Wang <wangkefeng.wang@huawei.com> Subject: [PATCH -rfc 2/3] mm: kasan: shadow: move free_page() out of page table lock Date: Wed, 6 Sep 2023 20:42:33 +0800 Message-ID: <20230906124234.134200-3-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230906124234.134200-1-wangkefeng.wang@huawei.com> References: <20230906124234.134200-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 93E5040028 X-Rspam-User: X-Stat-Signature: zp88yo64f7giktract7sj59mtosu3c8c X-Rspamd-Server: rspam03 X-HE-Tag: 1694003549-629120 X-HE-Meta: U2FsdGVkX1/6XNWNTjHsdwjDKcED4B3L5pi6kiJoIanguYRaDUdNYRWCu8D2jp95UHn7Z4TDws3TCpBS5zF4mVS4aOf00xrLcVEfI1tGWvCi/cTyyObmW0Xb1wKOOuwzsuLA2M2MQrZ8FlYPRafhQV9QjmsZpImjuyJgkcx67dLNTFkmmK9IWUp+4O4lNmAXUsOMdSez9E+6leXYOOmWSgFxzo2Fmet4qQbI41oWinD/rTwYVK1B0th+KisRjR+Y29J2PsXog28Gvs7jugGEUfBpp6nKpYW7rVXgJ65t3FUs2mZL1YD9SPivmBv4UPg/pZ09KHRwn7tv+aNUGubbqpizserCWb3xqHmvd0oyIvtnHkMqUengAlnyGIRTV9hzWwYdxSz64miSVAS/UGFa2VYObBVHZDlbnsJP0mYIQJJJk1zgo83oggFMonx5sELPe/ZvoS+arj8IK1xoHdn97m3CKBtn44qQeOF/CgWWNT+qBGskoRElcq+Q3J6eJKAZKltChSA9KaHrXCX/pnXI7GhOiciVUD2fvSjkDYMobpDDwffK5iZvXrlR/iyVEaStZLJ2g/rQLRaDPpiBMMFvUVT6Hg8CAGOxTe4UMp+lBtozNBX5V/uJVT3YDIcB/dPSxDzeD95x5YfXtMAxl2jluDH060d9KUD6dz2RrJFwLUdICOsZFwAvkeyqniVOlydstD3Z1eyqIpi0/gGPgm6c/O9i+S7n+5kMkavihqSq1tUvpMSkvAN1Zm789S+TauDz3pAT3qF3EwxwRWj5IcIuTH60nTu66ptZrQtarxdJtkjirZrGk/kNwj2UfN+TyYL9s1L0Cb6vqSnlphnn+lPG+H4oQLEBEbJHmtj/sFURjPOxmNxrDVdgInVvRf+FBZb2CRPJPGjRUhi9joGCR5VlsvC1ouIcvcGMvtf9PZShxV5Bn0cBdBG31hR6QYDlPxZwqi7HrcEA4DXtrNZc6nK 1UA3r/w1 W6VZskkXnTENyuoHQBDga9nftptYXVGgZcatS0Proi5rY7QY8JuzOK815b1C+sPndg7RImtOLZlKj8F3q1spLW0+T0TPt1G466u2geONkaU57BSWLApKkDBwsxAnpqPhJuSDPjNE6nZf8Mdb9sXuccvZyiplctViVcOD/bBqFuuvQXiXTGgYBBndYHTQjGHHRsf43E9liY2LOHwTTxv3V33kd7AHF6MUrgb/JUIU0hhwzmeNi93iSvfRyejPdFNY2TQCTP6O4wAtqGRQ= 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: <linux-mm.kvack.org> |
Series |
mm: kasan: fix softlock when populate or depopulate pte
|
expand
|
diff --git a/mm/kasan/shadow.c b/mm/kasan/shadow.c index fd15e38ff80e..d7d6724da2e0 100644 --- a/mm/kasan/shadow.c +++ b/mm/kasan/shadow.c @@ -423,12 +423,13 @@ static int kasan_depopulate_vmalloc_pte(pte_t *ptep, unsigned long addr, page = (unsigned long)__va(pte_pfn(ptep_get(ptep)) << PAGE_SHIFT); spin_lock(&init_mm.page_table_lock); - - if (likely(!pte_none(ptep_get(ptep)))) { + if (likely(!pte_none(ptep_get(ptep)))) pte_clear(&init_mm, addr, ptep); - free_page(page); - } + else + page = 0; spin_unlock(&init_mm.page_table_lock); + if (page) + free_page(page); return 0; }
free_page() is not needed to be protected by page table lock, and it will take a little longer, so move it out of the spinlock. Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> --- mm/kasan/shadow.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)