From mboxrd@z Thu Jan 1 00:00:00 1970 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 09AE8C433EF for ; Wed, 6 Apr 2022 20:16:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 016066B0071; Wed, 6 Apr 2022 16:16:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EDFD16B0073; Wed, 6 Apr 2022 16:16:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D31D86B0074; Wed, 6 Apr 2022 16:16:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0228.hostedemail.com [216.40.44.228]) by kanga.kvack.org (Postfix) with ESMTP id BE6B46B0071 for ; Wed, 6 Apr 2022 16:16:21 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 70B82AD6DD for ; Wed, 6 Apr 2022 20:16:11 +0000 (UTC) X-FDA: 79327560942.21.1C7BC68 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by imf13.hostedemail.com (Postfix) with ESMTP id 0168E2002D for ; Wed, 6 Apr 2022 20:16:10 +0000 (UTC) Received: by mail-pj1-f44.google.com with SMTP id m12-20020a17090b068c00b001cabe30a98dso6861189pjz.4 for ; Wed, 06 Apr 2022 13:16:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=MtaOLjhRf1Wo8K50mKrm1OoM/RVzH4UIFp1bXz8qRsg=; b=sY/akrYOjopY1kgDNHZfxZ8uMqW44HwRq3/2hL0xJtoteqZ7+DT0s4Ilj4GX9BO1u7 xWDTLdjW34bHwZ20fq8Coxh8FNEcII47+x00gcM5O6xOM/Tnc+dZrUDAvADMs774hutQ QVMjSfVkDTQNlZsFGZW4WTi6Bp7UfHL4W9hNJD3KhmMd9O0vvNIJ94h45TourL+NpNZF WTC0EXBuO/WkiriyjaKMci8eX0tD2xM8wO6YrZTHFHW078InxFdI4Q72qc0l+Ix0GvpS Rcq+ok+XjXMnmpxi37rl3trfLzQTq2thhNy0swL7rzibPgXSELiz3T+BHhW2NCx4qC2W DD9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=MtaOLjhRf1Wo8K50mKrm1OoM/RVzH4UIFp1bXz8qRsg=; b=sPwvV7SJruhfJUZBBBUtShXR+ayxGaxW3tVdNABo7bOL8xq6NrT1BDYjKSWkNvWvuI aQnFmFtTTwZaw0ZPj2YmrwkDeKkJjmozuDg3+rn6JwDc2zuAbtd2X/GXsGEwo/22ENrw lecHhnCDpgtJZ4vaK3x3aXTbHuaht+iW1DtV/5594YXsN9X0vRctJ9jJlcpWvAe9sh2Z SorNKRsajf/+mzl6DEvJ28QdhzBiGMv2EHI2kboCE0wQFh3kgBPf00Lzwcj88gpru0Ai Qqv3j0puxwDEd5lmm6FzO7iypD4jwDn7b+zjZfqyTRmwnCrwAcZE/mVkOcqej4Phx0QB 55dw== X-Gm-Message-State: AOAM532nPYesZeYFg9o+5dPSqBQrnqY2QfRqmkcw3LAXAG7Wm65kmqFQ WnowVJAZ0NgyzAlGVdAtmT/TwA== X-Google-Smtp-Source: ABdhPJy7T5WCBNEsJbNjavNzdlhr3HCaCF0WjBEcpJmC1j0vxc24FPj4PsRxBuYZofLcm9SIu+DdPA== X-Received: by 2002:a17:90b:1c03:b0:1c7:510e:d0c7 with SMTP id oc3-20020a17090b1c0300b001c7510ed0c7mr11943407pjb.107.1649276169844; Wed, 06 Apr 2022 13:16:09 -0700 (PDT) Received: from relinquished.localdomain ([2620:10d:c090:400::5:4964]) by smtp.gmail.com with ESMTPSA id nl17-20020a17090b385100b001c70883f6ccsm7258642pjb.36.2022.04.06.13.16.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 13:16:09 -0700 (PDT) Date: Wed, 6 Apr 2022 13:16:06 -0700 From: Omar Sandoval To: Baoquan He Cc: Uladzislau Rezki , Christoph Hellwig , linux-mm@kvack.org, kexec@lists.infradead.org, Andrew Morton , Cliff Wickman , x86@kernel.org, kernel-team@fb.com Subject: Re: [PATCH] mm/vmalloc: fix spinning drain_vmap_work after reading from /proc/vmcore Message-ID: References: <75014514645de97f2d9e087aa3df0880ea311b77.1649187356.git.osandov@fb.com> <20220406044244.GA9959@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 0168E2002D X-Stat-Signature: dtm8mhqkjs4iinrmw5psmsptorhos7uh X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=osandov-com.20210112.gappssmtp.com header.s=20210112 header.b="sY/akrYO"; dmarc=none; spf=none (imf13.hostedemail.com: domain of osandov@osandov.com has no SPF policy when checking 209.85.216.44) smtp.mailfrom=osandov@osandov.com X-HE-Tag: 1649276170-243464 Content-Transfer-Encoding: quoted-printable 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: On Wed, Apr 06, 2022 at 05:59:53PM +0800, Baoquan He wrote: > On 04/06/22 at 11:13am, Uladzislau Rezki wrote: > > > On Tue, Apr 05, 2022 at 12:40:31PM -0700, Omar Sandoval wrote: > > > > A simple way to "fix" this would be to make set_iounmap_nonlazy()= set > > > > vmap_lazy_nr to lazy_max_pages() instead of lazy_max_pages() + 1.= But, I > > > > think it'd be better to get rid of this hack of clobbering vmap_l= azy_nr. > > > > Instead, this fix makes __copy_oldmem_page() explicitly drain the= vmap > > > > areas itself. > > >=20 > > > This fixes the bug and the interface also is better than what we ha= d > > > before. But a vmap/iounmap_eager would seem even better. But hey, > > > right now it has one caller in always built =D1=96n x86 arch code, = so maybe > > > it isn't worth spending more effort on this. > > > > > IMHO, it just makes sense to remove it. The set_iounmap_nonlazy() was > > added in 2010 year: > >=20 > > > > commit 3ee48b6af49cf534ca2f481ecc484b156a41451d > > Author: Cliff Wickman > > Date: Thu Sep 16 11:44:02 2010 -0500 > >=20 > > mm, x86: Saving vmcore with non-lazy freeing of vmas > >=20 > > During the reading of /proc/vmcore the kernel is doing > > ioremap()/iounmap() repeatedly. And the buildup of un-flushed > > vm_area_struct's is causing a great deal of overhead. (rb_next() > > is chewing up most of that time). > >=20 > > This solution is to provide function set_iounmap_nonlazy(). It > > causes a subsequent call to iounmap() to immediately purge the > > vma area (with try_purge_vmap_area_lazy()). > >=20 > > With this patch we have seen the time for writing a 250MB > > compressed dump drop from 71 seconds to 44 seconds. > >=20 > > Signed-off-by: Cliff Wickman > > Cc: Andrew Morton > > Cc: kexec@lists.infradead.org > > Cc: > > LKML-Reference: > > Signed-off-by: Ingo Molnar > > > >=20 > > and the reason was the "slow vmap" code, i.e. due to poor performance > > they decided to drop the lazily ASAP. Now we have absolutely differen= t > > picture when it comes to performance and the vmalloc/vmap code. >=20 > I would vote for the current code change, removing it. As pointed out b= y > Christoph, it's only used by x86, may not be so worth to introduce a ne= w > interface. I did a quick benchmark to see if this optimization is still needed. This is on a system with 32GB RAM. I timed `dd if=3D/proc/vmcore of=3D/dev/null` with 4k and 1M block sizes on 5.17, 5.18 with this fix, and 5.18 with the non-lazy cleanup removed entirely. It looks like Uladzislau has a point, and this "optimization" actually slows things down now: |5.17 |5.18+fix|5.18+removal 4k|40.86s| 40.09s| 26.73s 1M|24.47s| 23.98s| 21.84s I'll send a v2 which removes set_iounmap_nonlazy() entirely.