Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3215350rwb; Mon, 16 Jan 2023 05:22:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXv6+moVD7ogG4vkzc6HJ+cbSSHEtdXjsnf4ovJ6eYd7iBkTMfNv14RgEcljoLGjFiQfZKA8 X-Received: by 2002:a17:906:5da3:b0:86e:c9e2:6329 with SMTP id n3-20020a1709065da300b0086ec9e26329mr7515382ejv.12.1673875341029; Mon, 16 Jan 2023 05:22:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673875341; cv=none; d=google.com; s=arc-20160816; b=D1mkoLlcmtkRGbRvTZ3WM+veHwAsu41Vd52z8pRvkTdhCGoxfq13JsS2JCQM+w87Io KQLxdPIyyO3szhF0fVG62QI4YnrWWXukcWNQSe0GASpTEc4uKyrbsovKAL4+CqUPYYoQ QaglBMODGE5thhgK543amJTNkB3SvmhcFmV+r/Co+HivaOntRbRpEcn3n0kO//h+jSSL ZQz8BMJDPuCLFp6XnMc/zyHMFQJnepQO7hcMkLech2IFCSGe3yjRl+Y2Um6Unz3fGUGB 6aOsfG62hR54tBLZj006EmYgPDBlWM0dU+B4mn/ArypUNsabbX4LgRJwJzNdJMJOvbXL ukMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MKTyGhr5JmgZRBNZqt+rjhrZa6A3qTkj64hOZc3GxsU=; b=VI06nEBX51jdL6GNsnB7XCcWYIiJNmUe7q37JXgzi+Np6NKm1U9HsgPmZfirCh2YYV HMByz5euYodXoACfYwT9jCE5v4xa4yoGWtMyG1nXkJrQCzkkZ6jJhv/6YQMiFcJqpxON XqFi9Rt7/5rvQP79c2uHUvfxKbm/992L6apbB52OOhXlHl3ldoROQq4aWwTRY0Ur9SSp KeIeU8UWYLJ9wxWZIVlXk3i0nen/NyIEv5I7uS5DMLWe4FEbHms7z73MvOQLuUCpCJQS mJi2D//pR/rV7cR3ixkVuAjY/9QmC/3DbWCqPkBw8sa/6V9j/js2wwAPnP58vi54RmA2 HC1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kuxSNSdG; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n11-20020a170906118b00b0086deeba29cbsi5014956eja.561.2023.01.16.05.22.07; Mon, 16 Jan 2023 05:22:20 -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=@gmail.com header.s=20210112 header.b=kuxSNSdG; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229751AbjAPMYu (ORCPT + 51 others); Mon, 16 Jan 2023 07:24:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbjAPMYs (ORCPT ); Mon, 16 Jan 2023 07:24:48 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F4321C320 for ; Mon, 16 Jan 2023 04:24:47 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id t5so22903383wrq.1 for ; Mon, 16 Jan 2023 04:24:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=MKTyGhr5JmgZRBNZqt+rjhrZa6A3qTkj64hOZc3GxsU=; b=kuxSNSdGkO43VAT6j74zd5xdCxE/3m5V8FnfXho8FbeGfpyJqCySa+wep5gvpKmXxw yciHP4/gGI59CtxOtQMdahsyXutvSH2jlMoi24mKyJgZ9IcSSxXhRDOlOE7zUiFL1v9J J0BWACi3higPxeMUI4B2jmhTqWlDcClJgyqrAkFvAoioPLxp3EZyq0Su2u34eE8nE00g e0SrgJKZkpv0KohDepUd93Iy4aqYTo/o8rglA/I9JPBGqHs2ClZD8RxUejkAeaws+NKl i+TFaDm2Fs76MQOKHt3n2Tngwr6CK8Io6AjnK5rc7joJAddmceJWKAzsUrsyOnRjS/7+ 8kzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MKTyGhr5JmgZRBNZqt+rjhrZa6A3qTkj64hOZc3GxsU=; b=rBZlJIRsPyDGJnXl7sgfhha5g+q7hz3A2Q9z5XepB0EKfRDkJNsmh2agKJECXPYH2w TQ+njcbMV1ZsoMEh33vTqcjmbFZeHTsImkeXqF1kLFs75MaXZbgsSavruq3yMuoB+a08 srU6KTWvWQJVZIXCZitDtKr/QxZAJXS3doZr3+MRcNepE6Mssu1y4f/0AwY+MWfr5j6n 6QD18AP/3B+cwdeydFuZqVpqX0N0i7gWvK69OndufoBJ0uiYQfBMGXXv1xyZDyHnXdHu 6Vj6Fwx/rtR7UTfr8zyBlqlidP4jTKH6LcI77YIuJQB/Cp1GmEudfU8NEPzIc143/wQK 18+w== X-Gm-Message-State: AFqh2kqENgShERj77FEu8Llkzk7USb9OWvjHBWbfMC771mHsqgjTwPKc WWTT7jo1BcNLvTIa41KAGK0= X-Received: by 2002:adf:f70b:0:b0:2be:34f:4fc4 with SMTP id r11-20020adff70b000000b002be034f4fc4mr3470601wrp.13.1673871885840; Mon, 16 Jan 2023 04:24:45 -0800 (PST) Received: from localhost (host86-164-169-89.range86-164.btcentralplus.com. [86.164.169.89]) by smtp.gmail.com with ESMTPSA id f2-20020adfdb42000000b0024274a5db0asm26335772wrj.2.2023.01.16.04.24.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jan 2023 04:24:45 -0800 (PST) Date: Mon, 16 Jan 2023 12:24:44 +0000 From: Lorenzo Stoakes To: Baoquan He Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, urezki@gmail.com, stephen.s.brennan@oracle.com, willy@infradead.org, akpm@linux-foundation.org, hch@infradead.org Subject: Re: [PATCH v3 5/7] mm/vmalloc: skip the uninitilized vmalloc areas Message-ID: References: <20230113031921.64716-1-bhe@redhat.com> <20230113031921.64716-6-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230113031921.64716-6-bhe@redhat.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 13, 2023 at 11:19:19AM +0800, Baoquan He wrote: > 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 > --- > mm/vmalloc.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index 4a10b3b692fa..dbcdcad2276b 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -3660,6 +3660,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); > > -- > 2.34.1 > Reviewed-by: Lorenzo Stoakes