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 DA03BC636CC for ; Mon, 20 Feb 2023 14:43:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 79B996B0074; Mon, 20 Feb 2023 09:43:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 74B026B0075; Mon, 20 Feb 2023 09:43:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 639B06B0078; Mon, 20 Feb 2023 09:43:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 55BAA6B0074 for ; Mon, 20 Feb 2023 09:43:30 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 25B2F140352 for ; Mon, 20 Feb 2023 14:43:30 +0000 (UTC) X-FDA: 80487938580.08.AFEB9CF Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf10.hostedemail.com (Postfix) with ESMTP id 73BA5C0019 for ; Mon, 20 Feb 2023 14:43:27 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=EledkTIN; dmarc=none; spf=none (imf10.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676904207; 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=VeqL6y623h+FMhkEfavLpT75Tlfn0L2408lWtNODo6o=; b=QezTo9PY9sKW9FzqG+82RAQ7Ce7MxoS/mzPUXjgmDpbba5K1ITXnrowFVvUmXxDwjWkwj+ u+/MZCMAoOn+hfo9GgvcUAPqEnI2MDTm/dxe4ETuyz2KQMaUQs/0807DSMQn0PcumlXLuh tVnuLW23PGxTSGGH9R3y5mxSfQikRl0= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=EledkTIN; dmarc=none; spf=none (imf10.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676904207; a=rsa-sha256; cv=none; b=nO8Zxf+ywrQHCUXYjsoxpkit50K0jXhWEP4dPBjFr8lH9n7aoylHO0WROVQcpXZP/HfQm7 nsUB/eRtrvmaPhiT04V2lJB+WaTD7IglK3KESRCj04wxpSuY7VYtQXoyJHOCBUMYBS3fil ZQZSRUzj6vz7kPl7B60qKIl1fiCD6vY= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=VeqL6y623h+FMhkEfavLpT75Tlfn0L2408lWtNODo6o=; b=EledkTINaaMwY15VWWJ0YF4EPm jTww9uFc+igziLg5X+BwRijrnJh7sE2pL4oNdUnknWXb/Oa3aR3x8z1Urlyc0At8XV9jDwssM5WV+ qIPxVxvRMoRc6XAjHabcy3exsxlYvK4+MdofR4b63RkphkjSWo/bollQ26oXFHXeb+ngaRS7+KN4Z PQbamb35BvY5yoW9WtTGXrSMFSeA8Jz9P/OKpENrgxAjpY7B6S+MM+gSHMwiMiOiFSi3AEUsofq0y lAUcQ5MatT2Kk0YnrwTDGCVCH1u+ukA0ZHE//cn6Cep96xPfocBq31F9cGmy/kHN0eNioqyDrQ59E 2PDPqtpQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pU7Nz-00BnYk-FD; Mon, 20 Feb 2023 14:43:23 +0000 Date: Mon, 20 Feb 2023 14:43:23 +0000 From: Matthew Wilcox To: Hyeonggon Yoo <42.hyeyoo@gmail.com> 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-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 73BA5C0019 X-Stat-Signature: 5qifi51a5tgi7hjm816j6i3aeswgskdc X-HE-Tag: 1676904207-813831 X-HE-Meta: U2FsdGVkX1+2+owYNIjA8cSl094EsqkdeG+j49ZdBJ7Mdq8D1nK5mCKkc2Ab2VnW7oaCGV1UkAO3t3KXnGejaxfnk1wVYhnfW63ajIzwUtyAGZ7tbMP7diLf+GXe5qoUyy4Ocbykl+SCbqEfAfR9aoAxVO1ldJLCOIf5NRBJGft04Xzb8DtYahAY5vnSqFtfcWbtP2iavXIPrMpFHfFsIe4UWA+DcdkJ9ulm1sYxk4BNvH5SbEOjVI+X/t3qh9KIroiBmxoRMFiDXW/POhf683torAKQ+fV8BIdfF3ahykaMjGQDdKNO0ryvVTYvSJGBcL9B5XPA5jOEBcE9wLJF5UELgS0rqn6JNjHIdov/bZcQUJBqAbioVT1eakt8m7aHXgFPCud3YAu5CFNqdtbahrWubNY74jW4acyzYHhCcW2sUBi1KpZkuM/ly0E6QFX3xdlpYFGpMopX0SGCTiZD1c8ABGijzePBWVNrDKU8daYAFsbVp4exqMEFm5gbYNmwyQSDIMuuB+jt7G/c9Nd02IKHv7dSQDLuwdP43d3xEYdnau7hEHDzmt1poVmiqGx8FX8Le7bXaCIzo/CyKqwIdwYw8H2ITSt8fo6m4Yx9CKn97S4iDyiPkxlV/AHl42ALN4z1JOBuSBsIqSBlcwYS8wWRzmG5y+e60p/LKujmRtgZizvZC+ljKsmakCiTmMblYW3OPOEeUkfKzaJwv531uR+OhBPfWgzbAWJQ4hTDFohmZkfCYy15mtVGtcw4n5TlGV9yuOezcnYchmYkQuiAWYZWR+pIn4WbnvBxQ2SVKqjWde0gpovTamIGfNQw2pzyAXO4g2xzxaISSAr7sW5oQtBssTyeFzzecEfym0fm893Bc/3tH3IeagQn2hwMcL414qd6UcDNpPTqZaXoDlpNDHMA4bi+ETFIf+TWcXtFB4jRX5TyM6M0fxUhBoCsohBFC03Wjcu0Bf9b9V1tOD/ tct6XHFQ CnrRRyN1KLOZLJYmLyJ75Bci+bEmFf0AsTG0/DUDqTJQj2j+J5izjIQM4b3Nr+PYgufe8UsyIfHekl1tLgPyrRnXPIwEGm8QBVjAlXkIme/mOqN7ihx8HWCAchqTDwONZZf6FVR9XWLSpvlvHRLNMoAl4HWwWuUWnNfK40i7JUnCz04paw0AqHmbnemFbTWL5vX2Z5f+V9MrAU83Hfoh2Q0VvEmMJBYmpK6lmy45tCLz93hKYAstjxMzUIwlWGbkLqeLfzJAEfoFeS/Ee2n5YYJxYjYJhGVmfoOqO+J0xwi+JvUNgurnIFLpwgToz6TxnYP044RlvTbsv0eEhO+Hlffshq/xkUzRrDE3FsHpyf8msv6D1neem87axZnGkCukIwOred5om0NgWRGikDrQZSl+ZUHCaYx4DguWz9svJuSg19HoyGRIBXXRi4KieSfp3vHLy 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 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. (The __p?d_alloc() approach may also be useful to support vmalloc() with flags that aren't GFP_KERNEL compatible)