From patchwork Wed Feb 23 05:21:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junaid Shahid X-Patchwork-Id: 12756381 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 0C157C43219 for ; Wed, 23 Feb 2022 05:24:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 11CC98D0017; Wed, 23 Feb 2022 00:24:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0CBF58D0001; Wed, 23 Feb 2022 00:24:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E5FA78D0017; Wed, 23 Feb 2022 00:24:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0088.hostedemail.com [216.40.44.88]) by kanga.kvack.org (Postfix) with ESMTP id CF3ED8D0001 for ; Wed, 23 Feb 2022 00:24:33 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 9B7179F5DD for ; Wed, 23 Feb 2022 05:24:33 +0000 (UTC) X-FDA: 79172904426.20.FC09611 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf10.hostedemail.com (Postfix) with ESMTP id 34D70C0004 for ; Wed, 23 Feb 2022 05:24:33 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id o5-20020a25d705000000b0062499d760easo8077273ybg.7 for ; Tue, 22 Feb 2022 21:24:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=wpN/U5eluX6Jnat+pEDX2C0UlbFhsXsgqK2IMjW00B0=; b=eO68TZsayJUnzF9ppfHaPSwA9f3cpJtiM/bQv1NjIx1viksnomhVCZg/OPfesExCQe GPBpKhmjuCayGTZhMCQafKSmuYZ+smeOmFtUbvbkWS5siPQw7nd2sd5jds4KSpKgIMG1 5rAZMh+2rFOS1AHpWlupbprjH1FaaIPoFdMADMVIZrEncJu5IwxbAAD77jq17vk7nHI/ pHx7Yx3y5+Ja+7mdhxYJ7U+IEaib+spU25N1cAyqYIyEgycYL490w9sjOc0zBhbj55fl oXav/h9TUMbHXVfYpZ1MYXyKyDqxgCsBYAWNUi6HD47X/71tlKLWuj7QNFucy0Ul1WpD v86A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=wpN/U5eluX6Jnat+pEDX2C0UlbFhsXsgqK2IMjW00B0=; b=J5PHvvW+XhYpSaqxbA4o1FAdmyfppUF+wnDSdI0aHt6CAgxC6GWOj5BQ+qt/UtlLQh eM/1d4Y8yEe/x4TWBzX9xlTHPRA9Xk909cGgn2+QOyvuQK3y5BW69t+XdrOH6WeZbrcz I+iS5cC2cwHEpcsc1GsxgDa/oYlZuJhiSiV8Xqn0KEWLSRMTInQ431J0TreIJrNkNj3b awBioznCYJJGqOw+1yOcVqdOvk6jkbYizcCU129BGgAKvsUAk7gzKRB3/P5GJsXQHQL2 CNxzMAkSZtBnK2FF6EfWL+BYqq4/q70Pxbd9IwdZu6vR3yUjAoxzmgfn8CtgU8FG+D0U VpRQ== X-Gm-Message-State: AOAM5318Kvb0TgXn2yVVe+f1QoS8b3r+NmHtX3XrR7YUjD3vHnZXf8HR G2lUuD0zWfbq+/Kh+RmUFg4LX0rcHMf3 X-Google-Smtp-Source: ABdhPJy8YBcGGLS1CDa1jQAvWHy6IX+C9Fx9N9t0vFRpgYOq3ptmbXD9mdu9QbdYBQ3ESjXtAc+9DWkF+HCP X-Received: from js-desktop.svl.corp.google.com ([2620:15c:2cd:202:ccbe:5d15:e2e6:322]) (user=junaids job=sendgmr) by 2002:a81:7141:0:b0:2d3:d549:23f8 with SMTP id m62-20020a817141000000b002d3d54923f8mr27573261ywc.87.1645593872454; Tue, 22 Feb 2022 21:24:32 -0800 (PST) Date: Tue, 22 Feb 2022 21:21:57 -0800 In-Reply-To: <20220223052223.1202152-1-junaids@google.com> Message-Id: <20220223052223.1202152-22-junaids@google.com> Mime-Version: 1.0 References: <20220223052223.1202152-1-junaids@google.com> X-Mailer: git-send-email 2.35.1.473.g83b2b277ed-goog Subject: [RFC PATCH 21/47] mm: asi: Add support for locally non-sensitive VM_USERMAP pages From: Junaid Shahid To: linux-kernel@vger.kernel.org Cc: kvm@vger.kernel.org, pbonzini@redhat.com, jmattson@google.com, pjt@google.com, oweisse@google.com, alexandre.chartre@oracle.com, rppt@linux.ibm.com, dave.hansen@linux.intel.com, peterz@infradead.org, tglx@linutronix.de, luto@kernel.org, linux-mm@kvack.org X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 34D70C0004 X-Rspam-User: Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=eO68TZsa; spf=pass (imf10.hostedemail.com: domain of 3EMUVYgcKCAks3wjrm1pxxpun.lxvurw36-vvt4jlt.x0p@flex--junaids.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3EMUVYgcKCAks3wjrm1pxxpun.lxvurw36-vvt4jlt.x0p@flex--junaids.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: w9fmbkjanc3gh9rus7mu7aofkdz6y35k X-HE-Tag: 1645593873-969337 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: VM_USERMAP pages can be mapped into userspace, which would overwrite the asi_mm field, so we restore that field when freeing these pages. Signed-off-by: Junaid Shahid --- mm/vmalloc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index ea94d8a1e2e9..a89866a926f6 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2424,6 +2424,14 @@ static void asi_unmap_vm_area(struct vm_struct *area) */ if (area->flags & (VM_GLOBAL_NONSENSITIVE | VM_LOCAL_NONSENSITIVE)) asi_unmap(area->asi, area->addr, get_vm_area_size(area), true); + + if (area->flags & VM_USERMAP) { + uint i; + + for (i = 0; i < area->nr_pages; i++) + if (PageLocalNonSensitive(area->pages[i])) + area->pages[i]->asi_mm = area->asi->mm; + } } #else