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 BA468C0219B for ; Tue, 11 Feb 2025 18:28:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EE4076B007B; Tue, 11 Feb 2025 13:28:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E6D566B0082; Tue, 11 Feb 2025 13:28:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE6F36B0085; Tue, 11 Feb 2025 13:28:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id B11756B007B for ; Tue, 11 Feb 2025 13:28:39 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 6D87A1C7E07 for ; Tue, 11 Feb 2025 18:28:39 +0000 (UTC) X-FDA: 83108499558.01.3110F04 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf23.hostedemail.com (Postfix) with ESMTP id AC4E3140019 for ; Tue, 11 Feb 2025 18:28:37 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NoHbc5cG; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf23.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1739298517; a=rsa-sha256; cv=none; b=AD1sDOe96M8yH6rSjiydEClYpfSAOsZvZIWPMDVUUG4msfBaATBTw3xXXIAd0yEsyYl48z HGC2v9kLEwxNajfVFjjtossTWdgZkGPlIc/MxJLdepsXKJg49cAPyglSlgX4y339OnZOj5 kWhSz5P551uilZfdHJ82iW/Qxx9oZq4= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NoHbc5cG; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf23.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1739298517; h=from:from:sender: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:dkim-signature; bh=BN6MRcFd23+GzKjAkeGGzwsWuVANr/LW6+I/mLbnbk4=; b=MRALXzQlobrP6ClgFZFk9RM0Hd6hwMcir/FK7uDm9lSwvwxiPhLCRSaoadCwA2rSfyj5Oa dGwanTxX1Co6qOVoMF0WPiHNIDUz5n8YuvI8VCiVAcA5YpDa85rdUQ7JK+t0pgKIoEhyUx PGX69axlKjuHiHKgVfA22Gfj5/LMKPo= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id F38FD5C481C; Tue, 11 Feb 2025 18:27:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16B14C4CEDD; Tue, 11 Feb 2025 18:28:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739298516; bh=xtsFazpjIaHcD9JinahzPbL8TpyUe+HBgeXCBVekqkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NoHbc5cGFa40Nj8sTlOcRX4xQkIjoYaw3UwZRnJXys/3kzLJTjxqIZ/TQdY7xvyPd RbFzzeSw/W997NER6uyZoH/dfo3y2EvPab2DG8b1AstU7YaK2HtW9TSeGJ+Gf4yPIj hIzJyoFu7no8oCyspChYukzbi/zxqcTmm+g42B5LnUYyUWO7dt+cEEhIRkZ/1KMsMq 5d8JIXipQgSSQiveLMkPQEUhDHmcMCykRrnlcbdfaPPHrAKp5GPVSpRQ65Nr/mPbAt ddjyJeamJ2be3nxKVur8/FGi5lTeCAvkPHhkb2E8OGIuE3xo8eAs6wx+oHRZ6y3NXi P9jOMkFa9O5PQ== From: SeongJae Park To: Vern Hao Cc: SeongJae Park , Andrew Morton , "Liam R. Howlett" , David Hildenbrand , Davidlohr Bueso , Lorenzo Stoakes , Shakeel Butt , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 0/4] mm/madvise: remove redundant mmap_lock operations from process_madvise() Date: Tue, 11 Feb 2025 10:28:33 -0800 Message-Id: <20250211182833.4193-1-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Queue-Id: AC4E3140019 X-Rspamd-Server: rspam12 X-Stat-Signature: wjso9e4pehxxcsx8qzoyag476ttacri7 X-HE-Tag: 1739298517-908299 X-HE-Meta: U2FsdGVkX1+US1lXUNKPJGH6nVNX5IubnxLjOIcV/K85GJc2ro9WpjwhdvpQ8Ot6x/pvVjK1/fSXEBviyjUnPqwHNDzRqYjjU92Zeeh715nQQZ/IubkgLBFqc0VEO0QPH8YXSWwO+epz4YEbrqxR0ype+CdY1sqLIOCTZTfawV1NOpwoyChPIlwlJ2aEbXZgsJpW99+PUnDR3ObeVntSSrSjwjskAXJueciVK9JKU1syh+KUadLUKnY764DlNVdjUmQqFRktrPYO9ZjNiMzHhlnnlch2kaNkuqaWgNLirSvyfaSpv+CcIPv/4CfooJL7U5jDqJpTuphAyTHCncPM0rsPff9cJt6ub4XdC/t7KY8BAn0Vp/BvUsAGQa/tIA0yYNBtVI+/vj6tjbZoo2lRue8REfyStsvpZ2w9Z/dj8vc8wKYXvHVdIIOXIwluij/Z5DJGAlk45zpVFMFCwXn0rf8m6eyV/VE6ccL/t0jeEWa7i3uAee258Vs6Ghpvdu/qMRyxsfRnbRIMqrHjuhr33EKOfSmU4iPQhE8m60N9wWEsyYle+SNL6Xf0UU+429LY1AV7zNROT1Oq3lV6G9RulsdebKu0AYtaWeQRvmIls3iR/GiN76ZIYpysOjBEGjUP9G0H+2KL/YOGqYy7MmTxpcFuPPOz43611kKrtCOEYg+YciQ6scAJ9sQ947Y6aZpLuvFVJjZCUFUTkRCic8s4GTlLdHjDNbAG28tMBARcJbixGnuL4bH+s3EIf/xz/tDxLYrXUqKEszwirgy1Zvo7uLjwl2fGBqMtgZwvCDVjxW7aeopOASTRccJAQNGALePTab3KmWSB9NTATmcRnA3ALQxSEz+7+9FD9IbNPUB00DFB5icD3GJRX7vRaZbmstbHnHjRgGONny9+QuZNjoG9so+CDpVWFCxyPf4VMbnQcPhYCqTeKZuZAE+iwok3dbrLqZpa0VE219sp69/5Nvr rwKd+lNU GCuTaVIN8BTXm+H6xJmyUgTv4OcrK/FhkL7uZ/y9R+OJGZAtoRV9YlGeLl+T21LyT7F99fFKiD1z+iIzOjdTNMpwihdguSoSeFhox2a4/8RO7jQ1JH4WcOQeEVihC3skr6Ee8xK81/xLPtBiIaecANUEGI/d8DBWc33cTqldnJfxeFgnzGgjjZHbjGD4ukMvHNYL8KAAQcIfwiOvE8yoygqjx7EKk7kuZPj7FgZ1H+eUGImGCbjJMyUW9bSTEOVmm2vCTa1QIYXyAV3rNsm+khCTiykLMzOR4b431yvPbqZ/qRutopba44cNd9w== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hi Vern, On Tue, 11 Feb 2025 16:48:06 +0800 Vern Hao wrote: > > On 2025/2/6 14:15, SeongJae Park wrote: > > process_madvise() calls do_madvise() for each address range. Then, each > > do_madvise() invocation holds and releases same mmap_lock. Optimize the > > redundant lock operations by splitting do_madvise() internal logics > > including the mmap_lock operations, and calling the small logics > > directly from process_madvise() in a sequence that removes the redundant > > locking. As a result of this change, process_madvise() becomes more > > efficient and less racy in terms of its results and latency. [...] > > > > Evaluation > > ========== > > [...] > > The measurement results are as below. 'sz_batches' column shows the > > batch size of process_madvise() calls. '0' batch size is for madvise() > > calls case. > Hi,  i just wonder why these patches can reduce latency time on call > madvise() DONT_NEED. Thank you for asking this! > > 'before' and 'after' columns are the measured time to apply > > MADV_DONTNEED to the 256 MiB memory buffer in nanoseconds, on kernels > > that built without and with the last patch of this series, respectively. > > So lower value means better efficiency. 'after/before' column is the > > ratio of 'after' to 'before'. > > > > sz_batches before after after/before > > 0 146294215.2 121280536.2 0.829017989769427 > > 1 165851018.8 136305598.2 0.821855658085351 > > 2 129469321.2 103740383.6 0.801273866569094 > > 4 110369232.4 87835896.2 0.795836795182785 > > 8 102906232.4 77420920.2 0.752344327397609 > > 16 97551017.4 74959714.4 0.768415506038587 > > 32 94809848.2 71200848.4 0.750985786305689 > > 64 96087575.6 72593180 0.755489765942227 > > 128 96154163.8 68517055.4 0.712575022154163 > > 256 92901257.6 69054216.6 0.743307662177439 > > 512 93646170.8 67053296.2 0.716028168874151 > > 1024 92663219.2 70168196.8 0.75723892830177 [...] > > Also note that this patch has somehow decreased latencies of madvise() > > and single batch size process_madvise(). Seems this code path is small > > enough to significantly be affected by compiler optimizations including > > inlining of split-out functions. Please focus on only the improvement > > amount that changed by the batch size. I believe the above paragraph may answer your question. Please let me know if not. Thanks, SJ [...]