Message ID | 20230206084020.174506-6-bhe@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2121940wrn; Mon, 6 Feb 2023 00:44:39 -0800 (PST) X-Google-Smtp-Source: AK7set+0bLgEu3lUEq9J7SAEq1vKtKl/XNjOL6j2zyKpLdB4BcQ2xNph3aGEJir8afaOtdmvIBfG X-Received: by 2002:aa7:959b:0:b0:593:9620:383 with SMTP id z27-20020aa7959b000000b0059396200383mr10727782pfj.28.1675673079437; Mon, 06 Feb 2023 00:44:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675673079; cv=none; d=google.com; s=arc-20160816; b=u+Yn9Eibk9S/loiKuc/gJldqUoVD7Uwhu5pYLwj/tMimbgXT6hIcS0qLzIazNzyr6j c8j9LppxFKYqB/gylXSclx7ISubWtuaWCfUhyrv6Y4XXsVzhxah1WBj8oGn/3n0rveyE Y9F0gMM5cQVf+rGEcnRT3q/jGYkJ5Dv5BJRpeSbRMpD916zDiHPg1u3BT3KPxEkD87YY owa4Be7ctdqXPdztnvs6OgFFSuYzFx2zulp/GcBPAthErYk3YhW22jfQq3OR0fznibXR g7YPW5IOKbtRtg0vsKGmd61IQb2TsrxjN0+f3Ww5I/WelpTIaFLRqvhfXgc59MUPHkaC T5Aw== 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 :dkim-signature; bh=hiVEWJoEN/c7PwG6FQD6hYWxpoLbbmsKmDjpAMaWIR0=; b=Yjz9Q7pZmuUQ3Q+ZVveZPzL6Vvq3TnoSVJpi3pMpTl/jt0PD00fWJDJdsBAwK5ZHXj 5jAEn86VdTGROcaJ6OEd+kkLw4033OeDwG6MITnjV2H/cnhWu+DhUVtFDe62imgvxiLX vAhMg24TQQCXw/HsFlPe+bjkfYx9Hkpgm/gfa0knpdeUxWPeS1Jqt1Xs5+eTN7u5DCjB WajT8zTb0l2944NjsYRWaCW6CgqsMoIrUYEJmKl2GhpHCS3QTReZUpvsc2lB98zhamfR FIbHsyZmzSunWuS+MOLw7wNLH6vsRH4Tu0n0Ya7QLLHYZgrYQyA6osOOLW4jwd6mY0pU UsRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=C1ZgDxm1; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c22-20020a621c16000000b005627f4b21absi11619887pfc.296.2023.02.06.00.44.25; Mon, 06 Feb 2023 00:44:39 -0800 (PST) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=C1ZgDxm1; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229969AbjBFIll (ORCPT <rfc822;kmanaouilinux@gmail.com> + 99 others); Mon, 6 Feb 2023 03:41:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229940AbjBFIlf (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 6 Feb 2023 03:41:35 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BBC918142 for <linux-kernel@vger.kernel.org>; Mon, 6 Feb 2023 00:40:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675672854; h=from:from: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=hiVEWJoEN/c7PwG6FQD6hYWxpoLbbmsKmDjpAMaWIR0=; b=C1ZgDxm17Z6zTPM/85h3MgVE+xoaPAbEDaoR6NyNzn1xf8PYLZDADxhPDQsPnCw2KA8FtX Y28YA/7xbOBrZLDdkfddSWU+LY77+IQJtrZ6XkIdZnK6AAjTiXbP5LTQtjR4+Zyfj3ZGlF HbGi0pNIxWXsnOSCMWILxAs3L1tCFSY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-622-GSAZ0BOoM8aVUFekIGNdrA-1; Mon, 06 Feb 2023 03:40:52 -0500 X-MC-Unique: GSAZ0BOoM8aVUFekIGNdrA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 120E687B2A0; Mon, 6 Feb 2023 08:40:52 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-71.pek2.redhat.com [10.72.12.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id DFD372166B2A; Mon, 6 Feb 2023 08:40:47 +0000 (UTC) From: Baoquan He <bhe@redhat.com> To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, stephen.s.brennan@oracle.com, urezki@gmail.com, lstoakes@gmail.com, error27@gmail.com, Baoquan He <bhe@redhat.com> Subject: [PATCH v5 5/7] mm/vmalloc: skip the uninitilized vmalloc areas Date: Mon, 6 Feb 2023 16:40:18 +0800 Message-Id: <20230206084020.174506-6-bhe@redhat.com> In-Reply-To: <20230206084020.174506-1-bhe@redhat.com> References: <20230206084020.174506-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757070575184671505?= X-GMAIL-MSGID: =?utf-8?q?1757070575184671505?= |
Series |
mm/vmalloc.c: allow vread() to read out vm_map_ram areas
|
|
Commit Message
Baoquan He
Feb. 6, 2023, 8:40 a.m. UTC
For areas allocated via vmalloc_xxx() APIs, it searches for unmapped area to reserve and allocates new pages to map into, please see function __vmalloc_node_range(). During the process, flag VM_UNINITIALIZED is set in vm->flags to indicate that the pages allocation and mapping haven't been done, until clear_vm_uninitialized_flag() is called to clear VM_UNINITIALIZED. For this kind of area, if VM_UNINITIALIZED is still set, let's ignore it in vread() because pages newly allocated and being mapped in that area only contains zero data. reading them out by aligned_vread() is wasting time. Signed-off-by: Baoquan He <bhe@redhat.com> Reviewed-by: Lorenzo Stoakes <lstoakes@gmail.com> Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com> --- mm/vmalloc.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index dea76e73e57c..8037527774db 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -3668,6 +3668,11 @@ long vread(char *buf, char *addr, unsigned long count) if (!vm && !flags) continue; + if (vm && (vm->flags & VM_UNINITIALIZED)) + continue; + /* Pair with smp_wmb() in clear_vm_uninitialized_flag() */ + smp_rmb(); + vaddr = (char *) va->va_start; size = vm ? get_vm_area_size(vm) : va_size(va);