Message ID | 20221204013046.154960-6-bhe@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1600433wrr; Sat, 3 Dec 2022 17:34:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf7a7F7in2LDgn75ETWoETERTV5UYm0eROucm5q8dd4Tyh8xromA5hWpHIduP7XKKDI2eypl X-Received: by 2002:a17:906:a147:b0:7b2:7b45:2cd2 with SMTP id bu7-20020a170906a14700b007b27b452cd2mr65056965ejb.615.1670117644478; Sat, 03 Dec 2022 17:34:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670117644; cv=none; d=google.com; s=arc-20160816; b=XS9jA3Du+EFJPaAL/rhMZ0bghSjAuuli5z9xgccKK74U+SzApU56y8Chjw1giLn6Sc veK5zDVb4XGL06iaJ1G7FrScb5nNCQfe0+h5Q8wRBGNsLtdVOSPO+OKg7eIqEjyLfdjg a9xbObWYR/k9nqLmgCZD/BxyLTcpgNk7pLkwxtznbFfjdYcGxltJDt1wKT0PcNmvBj+k m/Ut+5/fUOJEhQoxdL5RKaEizbY8obRsGAsq0CsRCtnplpeq2YCO7tzczItLNtcOl0iA fOeKPhWASaUVhRcJc1gB6yRbqn1x/iUumwvrgXPYTVmYI5MnQ3mE9XDI36MA0gqhnd18 w6GA== 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=wKUFea3iuo2ZSUdXWfK1liYiDAjCBI6QYsheARET57w=; b=sUK6TZGyBM7KAx+Aepj40CBaZI86vfCOWwokSoI5dInAjo/VuM2bbXxONgVclgjlVj qYiu5oV9r/6MzwqEm5FJd25Udwarn+z81Je64FIjDKisoKT/5AmP1z8+BO8TSyPYllmT Yfg3y5VDBYm0e5JRZvNL5gEwgo5+dB1S7cV8pqWl8iMJ1EP1OelIxcNJ+9cs+l6zoQB9 Hq+xohfuly38jZI6OANC0kuOoPDqDCtwABjEBXYBqFIFOT0JV+sfgK8ep1FZDH2A8tNL xMSOqRFK89zR/L7LBqPq3mDuRdJCGmTj9eXAfKFC4dmZ5Ss9mhQVztrMKjQ1dn0HhrDG UcWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bG3j35fF; 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 sg11-20020a170907a40b00b0078df3bd80b9si9493166ejc.46.2022.12.03.17.33.41; Sat, 03 Dec 2022 17:34:04 -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=bG3j35fF; 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 S229900AbiLDBch (ORCPT <rfc822;jaysivo@gmail.com> + 99 others); Sat, 3 Dec 2022 20:32:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229886AbiLDBc1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 3 Dec 2022 20:32:27 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDA5F1A205 for <linux-kernel@vger.kernel.org>; Sat, 3 Dec 2022 17:31:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670117491; 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=wKUFea3iuo2ZSUdXWfK1liYiDAjCBI6QYsheARET57w=; b=bG3j35fFY1fkG/rY/+x+XSLyjdMBS6e8ghRh+ZTHQfNOdb1M+vNChZG9aYGcAgXE88nJqP uBCEhOHHVChqFidRcpujYCKPM245WDjBihS0Dx53HcQcfR3jAc5Pfb0Cit6WZjsHh1i8I8 DOxKnAkc1yeph1O2ZAwIyA3JRAhtDxA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-447-tQnrB-I0MgKTwkmoyLoYDg-1; Sat, 03 Dec 2022 20:31:25 -0500 X-MC-Unique: tQnrB-I0MgKTwkmoyLoYDg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4C08B29AB41A; Sun, 4 Dec 2022 01:31:25 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-31.pek2.redhat.com [10.72.12.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 157391410DDA; Sun, 4 Dec 2022 01:31:20 +0000 (UTC) From: Baoquan He <bhe@redhat.com> To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, stephen.s.brennan@oracle.com, urezki@gmail.com, willy@infradead.org, akpm@linux-foundation.org, hch@infradead.org, Baoquan He <bhe@redhat.com> Subject: [PATCH v1 5/7] mm/vmalloc: skip the uninitilized vmalloc areas Date: Sun, 4 Dec 2022 09:30:44 +0800 Message-Id: <20221204013046.154960-6-bhe@redhat.com> In-Reply-To: <20221204013046.154960-1-bhe@redhat.com> References: <20221204013046.154960-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.7 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?1751245279427983302?= X-GMAIL-MSGID: =?utf-8?q?1751245279427983302?= |
Series |
mm/vmalloc.c: allow vread() to read out vm_map_ram areas
|
|
Commit Message
Baoquan He
Dec. 4, 2022, 1:30 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 it.
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>
---
mm/vmalloc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 3c60026fb162..3e7b7d2766f6 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -3616,6 +3616,11 @@ long vread(char *buf, char *addr, unsigned long count) if (!vm && !flags) continue; + if (vm->flags & VM_UNINITIALIZED) + continue; + /* Pair with smp_wmb() in clear_vm_uninitialized_flag() */ + smp_rmb(); + vaddr = (char *) va->va_start; size = flags ? va_size(va) : get_vm_area_size(vm);