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 4F33AC433EF for ; Fri, 11 Mar 2022 00:07:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A7FB78D0002; Thu, 10 Mar 2022 19:07:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A2FE58D0001; Thu, 10 Mar 2022 19:07:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 945D68D0002; Thu, 10 Mar 2022 19:07:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0229.hostedemail.com [216.40.44.229]) by kanga.kvack.org (Postfix) with ESMTP id 87B0E8D0001 for ; Thu, 10 Mar 2022 19:07:37 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 1298D9BE5A for ; Fri, 11 Mar 2022 00:07:37 +0000 (UTC) X-FDA: 79230166554.28.5EF8B4D Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by imf05.hostedemail.com (Postfix) with ESMTP id AD2BA10000E for ; Fri, 11 Mar 2022 00:07:36 +0000 (UTC) Received: by mail-lf1-f50.google.com with SMTP id l20so12230717lfg.12 for ; Thu, 10 Mar 2022 16:07:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pf8rf1OMQGSObXmZDXYEXQ18daTFzvZIlAUX3wagrnM=; b=DXqKBuAvajbkHGal0HqcorPGP+YKykthHYoqY0FTrwesmich1sfYC7kgi45b1N8art F5gdbFfpfZOXxYHVdvg8OpL06/MLb47+uMD9qahbmey6Xa0rLIpV5XnTEW+ZsfUnwTp+ sr/yA4Fx59hYtL3CvOY8Skqcugdh98A4APS+T9ENzQKqqGHvkTsGQSUfXHVSsDMPfH05 sof4FO1J09+W5hTFt+iypJaFh/rCExvudJsoJr8USNTrRM41dx41Qa5mg9ugZc+riQWU uutQ/f0GCJkOOFZDeaRTXnBJGj9ROmHP2GAZLft4zJdE2qJTLvhAh1lz8Dk/HpEP3cdk Ofdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pf8rf1OMQGSObXmZDXYEXQ18daTFzvZIlAUX3wagrnM=; b=sj+raKmJoTB1XgU/8ToA4hI0LP3g9CXuNp6zILhodSjwjt1fn+hC3s9iwlJmjQW/dO CzTx4INnSXxCjAvUdJMpIV39aRwlWHz2jiIrpK29q+yNj/i/niGOhr9wU1pbpTeO5Kwp 6airuF2RXxvea/JXCSwMh8EKQEqId+t6AszvcKl2L4BmiT71v4qlPJ7Jqsbcj9A3vu8C G5fa1dV8OIPhrGGIFLDg+6OqOXcZowBgVnZHllRpgRVNJHEMkQyd/I84xN71uYw+bl0h ErTGSM7yln/W8rkeg5/FKTML6WhxjjfP5gyTNKWPGKP+CcvX6jZaug0QYauJQgCOH/Q4 /ycg== X-Gm-Message-State: AOAM532PpFiN3k4MGZNZi4os/HfwrnXTuZDmTEx6la/mGv6/Lcok/psi SVe9jTb4ajkJyNQvTIa/GXRlC5c9Ut2iDdp003ITcw== X-Google-Smtp-Source: ABdhPJwJc1/H7E2wObjoZesyE6FvQLdgoVgPDGZiwVzGJgGZdScMIIyyXr6aJtOnDU78P3o7ZJIDfWw/oR53o85N+UM= X-Received: by 2002:a05:6512:2081:b0:448:59e4:7b48 with SMTP id t1-20020a056512208100b0044859e47b48mr4581100lfr.198.1646957254754; Thu, 10 Mar 2022 16:07:34 -0800 (PST) MIME-Version: 1.0 References: <20220308213417.1407042-1-zokeefe@google.com> <20220308213417.1407042-13-zokeefe@google.com> In-Reply-To: From: "Zach O'Keefe" Date: Thu, 10 Mar 2022 16:06:58 -0800 Message-ID: Subject: Re: [RFC PATCH 12/14] mm/madvise: introduce batched madvise(MADV_COLLPASE) collapse To: Matthew Wilcox Cc: David Rientjes , Yang Shi , Alex Shi , David Hildenbrand , Michal Hocko , Pasha Tatashin , SeongJae Park , Song Liu , Vlastimil Babka , Zi Yan , Linux MM , Andrea Arcangeli , Andrew Morton , Arnd Bergmann , Axel Rasmussen , Chris Kennelly , Chris Zankel , Helge Deller , Hugh Dickins , Ivan Kokshaysky , "James E.J. Bottomley" , Jens Axboe , "Kirill A. Shutemov" , Matt Turner , Max Filippov , Miaohe Lin , Minchan Kim , Patrick Xia , Pavel Begunkov , Peter Xu , Richard Henderson , Thomas Bogendoerfer Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=DXqKBuAv; spf=pass (imf05.hostedemail.com: domain of zokeefe@google.com designates 209.85.167.50 as permitted sender) smtp.mailfrom=zokeefe@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: AD2BA10000E X-Stat-Signature: art93oa7fxiez6165kdd91ht334o3zt4 X-HE-Tag: 1646957256-377969 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 Thu, Mar 10, 2022 at 12:17 PM Matthew Wilcox wrote: > > On Thu, Mar 10, 2022 at 11:26:15AM -0800, David Rientjes wrote: > > One concern might be the queueing of read locks needed for page faults > > behind a collapser of a long range of memory that is otherwise looping > > and repeatedly taking the write lock. > > I would have thought that _not_ batching would improve this situation. > Unless our implementation of rwsems has changed since the last time I > looked, dropping-and-reacquiring a rwsem while there are pending readers > means you go to the end of the line and they all get to handle their > page faults. > Hey Matthew, thanks for the review / feedback. I don't have great intuition here, so I'll try to put together a simple synthetic test to get some data. Though the code would be different, I can functionally approximate a non-batched approach with a batch size of 1, and compare that against N. My file-backed patches likewise weren't able to take advantage of batching outside mmap lock contention, so the data should equally apply there.