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 70910C636D6 for ; Wed, 22 Feb 2023 11:38:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DBFA46B0071; Wed, 22 Feb 2023 06:38:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D6F756B0073; Wed, 22 Feb 2023 06:38:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C36C86B0074; Wed, 22 Feb 2023 06:38:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id B4F1F6B0071 for ; Wed, 22 Feb 2023 06:38:46 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 7D85FC0ACB for ; Wed, 22 Feb 2023 11:38:46 +0000 (UTC) X-FDA: 80494730652.18.B4C4C3E Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by imf16.hostedemail.com (Postfix) with ESMTP id B2577180013 for ; Wed, 22 Feb 2023 11:38:44 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=lqo8nWk0; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.51 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677065924; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=bB79wAdHOhccgIgKxHO3ngiWb2aGeXlrThCcLMtoIgs=; b=sn430fG4HMNPXZwj5VVsUXM/IV6QTo09hH53Dus2GJg9oMTSt5GCQi4i7Y/+ryQDrrNGsN 7ejqxG1qLA3xRqvmzbKs5aLHBPNKtVoovAvgd40mqLmnAxMllIIOFB2tpi2X975nuUhSDT bxIB7EQ3WSfwQTEsDeX8a2DXKZieExQ= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=lqo8nWk0; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.51 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677065924; a=rsa-sha256; cv=none; b=Qulwyly20iSjx7OyWiXg4aapwj7TZrPp2DU+nDY83vkR/2za5vyNpCh/jtMx7nSejWsE1b TrazZ4vIaPEfJPEsAkYy5bL31/VeSC+F3jCkd4tBSFPsw+KBSxr/2QP4SgMssQuu2EEx2A 6DUV78JF30H/5/vG5rM5qozRrs3o5O0= Received: by mail-pj1-f51.google.com with SMTP id x34so5106097pjj.0 for ; Wed, 22 Feb 2023 03:38:44 -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=bB79wAdHOhccgIgKxHO3ngiWb2aGeXlrThCcLMtoIgs=; b=lqo8nWk0lOD/+QurxV1b6RQCKg8CoGSWEYqkmaptqTJYyXGZt2JFfCmY+WuwrZg1jc xQRnN8/7249VeaSVUsJog6fHrVlhh1vD7RkljWnGNoXLb3jo3LS4Pfx0SHN4GV7mY4CC 4NlmE+SF0HpUg7wiVj5uqu8ZpeuenI/dfunQsQG02ucWOVn4K2iJ6THBNw0cInrfCkUZ 53xCRRDFPJpok9RS2yphhnUyuSts9/ICey/nQbXu+0nitYTQdYcT05G14Qxd+SwNJ3Px 6EqrZRW9dhxSWIU2XLeaElkWcaNLCmIFj6BI0XC1131qr6CG5RRZ8+5mDTirut+HjnEe Ep5w== 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=bB79wAdHOhccgIgKxHO3ngiWb2aGeXlrThCcLMtoIgs=; b=holzSDqkf3EWQtaQiE5n2wpzslsvOhAwaV5jvxK1HSMI/TRkbQb9X3fljNBn5H0QyZ T/97lyGJL9r4kUZoWMNimxqB1VcUjkJX9Mc7lOipAnqE/xFH0J/Iv/+7k8yc8HYGd3uQ VvatKruOB/MPKeyhhMTgP3Nre5nMNhm3AeRBb/RKF4ButiskmNmkVap+HLG9EP52xTNN a85Pn82T8lIQ93/1OijwzgOy52iDMJF/C4VRWq1okeCx2lkFrT9lRjUJq74DmnUfSGks 94KSxz2E8xSunnyaSP4Wz2E4kcfBu50bFJqPzH+8++8N/WItq1x6gIu6xTK2d1HZr9pL EMrg== X-Gm-Message-State: AO0yUKUpqgT37TAlLePBR9sBaurojycDkCLXyP/Sls5B52CWwmjy9vEs RyU82u2sRtZ/wRpttgFIfFk= X-Google-Smtp-Source: AK7set/Qydw0Y+XJumLAea4LHGyqfuuOtp+JieG87R+0HETyteEwAWgHm46CbxzjVMbFiVaPBaLaJQ== X-Received: by 2002:a17:903:1c9:b0:19a:b683:e11f with SMTP id e9-20020a17090301c900b0019ab683e11fmr10226016plh.27.1677065923435; Wed, 22 Feb 2023 03:38:43 -0800 (PST) Received: from localhost ([2400:8902::f03c:93ff:fe27:642a]) by smtp.gmail.com with ESMTPSA id g22-20020a1709029f9600b0019a6cce205bsm398031plq.154.2023.02.22.03.38.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 03:38:42 -0800 (PST) Date: Wed, 22 Feb 2023 11:38:37 +0000 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Matthew Wilcox Cc: linux-mm@kvack.org, liam.howlett@oracle.com, surenb@google.com, ldufour@linux.ibm.com, michel@lespinasse.org, vbabka@suse.cz, linux-kernel@vger.kernel.org Subject: Re: [QUESTION] about the maple tree and current status of mmap_lock scalability Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: B2577180013 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: e4k6yfyjaz51cxqf914xdo7s19st4yzc X-HE-Tag: 1677065924-808827 X-HE-Meta: U2FsdGVkX18C8kvm/927OR1/hp7GnmKwAp+It7K0OqMf2b39iGC7KxEuvBagt/wrKLoAzCSgG+Ln+ibMAJk56vjQIu5VrL41mQkIbkIn2y8hkJA+8oIICTSuay7+94Nl2HBEUVVy8D2K5wf9J1pGlZifRVdNOPhuM0cA6EdDR+1CUJwzgTaDlviSMBOODEwLubzNHqbRUiCmdzepTwQJQR8jqUsLmfTeYLHGkhGlStPwBjHBmrgLrI4G5MWRJOUsm514xYuw6MZrAc5nV4tU8BRJViBoFUm/yG9ruKeUQxfH/2JGj8ffVeGqRWej24rrx9pdIEaRblRoQlpLHM82DSY5+uZtFGxIKNbw8id0wFesOWQ3xWSiq4OD07FeAuCC4zXwuwF7feJDhmwkmdreWGstZpC9BziUAqRU/reZmBHpT6spDWiJINX8n3xzHVRp/jBBQQ1PH/5QF/Rdp7IkyQsMdopj5q9FjKk7rckqZM85OPQxLhhEZZ/IPHIDUp/SDTeE2LVMMsOF8h7uDpvr6Bh5JkIsj/fZ8MwPcjuI/Y67C/8uqjfPtlHvud4Fhak6kG/CdoV4JRG6iJZczH6ffhRf4DcXX29fT6ivE0gvUZkwgNqq+JLaPH4Hya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ity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Feb 20, 2023 at 02:43:23PM +0000, Matthew Wilcox wrote: > On Mon, Feb 20, 2023 at 02:26:49PM +0000, Hyeonggon Yoo wrote: > > On Mon, Jan 02, 2023 at 02:37:02PM +0000, Matthew Wilcox wrote: > > > On Mon, Jan 02, 2023 at 09:04:12PM +0900, Hyeonggon Yoo wrote: > > > > > https://www.infradead.org/~willy/linux/store-free-page-faults.html > > > > > outlines how I intend to proceed from Suren's current scheme (where > > > > > RCU is only used to protect the tree walk) to using RCU for the > > > > > entire page fault. > > > > > > > > Thank you for sharing this your outlines. > > > > Okay, so the planned scheme is: > > > > > > > > 1. Try to process entire page fault under RCU protection > > > > - if failed, goto 2. if succeeded, goto 4. > > > > > > > > 2. Fall back to Suren's scheme (try to take VMA rwsem) > > > > - if failed, goto 3. if succeeded, goto 4. > > > > > > Right. The question is whether to restart the page fault under Suren's > > > scheme, or just grab the VMA rwsem and continue. Experimentation > > > needed. > > > > > > It's also worth noting that Michel has an alternative proposal, which > > > is to drop out of RCU protection before trying to allocate memory, then > > > re-enter RCU mode and check the sequence count hasn't changed on the > > > entire MM. His proposal has the advantage of not trying to allocate > > > memory while holding the RCU read lock, but the disadvantage of having > > > to retry the page fault if anyone has called mmap() or munmap(). Which > > > alternative is better is going to depend on the workload; do we see more > > > calls to mmap()/munmap(), or do we need to enter page reclaim more often? > > > I think they're largely equivalent performance-wise in the fast path. > > > Another metric to consider is code complexity; he thinks his method > > > is easier to understand and I think mine is easier. To be expected, > > > I suppose ;-) > > > > I'm planning to suggest a cooperative project to my colleagues > > that would involve making __p?d_alloc() take gfp flags. > > > > Wondering if there was any progress or conclusion made on which > > approach is better for full RCU page faults, or was there another > > solution proposed? > > > > Asking this because I don't want to waste my time if the approach > > has been abandoned. > > Thanks for checking, but nobody's made any progress on this, that I know > of. Thanks for confirmation. then I think it's still worth trying. > (The __p?d_alloc() approach may also be useful to support vmalloc() > with flags that aren't GFP_KERNEL compatible) Is there any possible users of that, sounds like someone tries to call __vmalloc() in interrupt context or RCU read-side critical section?