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 DB59FC02196 for ; Thu, 6 Feb 2025 06:28:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6FEF26B0082; Thu, 6 Feb 2025 01:28:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AD8A6B0083; Thu, 6 Feb 2025 01:28:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 574DD6B0085; Thu, 6 Feb 2025 01:28:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 36D666B0082 for ; Thu, 6 Feb 2025 01:28:08 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id DB7591A0EEC for ; Thu, 6 Feb 2025 06:28:07 +0000 (UTC) X-FDA: 83088539814.15.FE23615 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf15.hostedemail.com (Postfix) with ESMTP id 3F8E9A0002 for ; Thu, 6 Feb 2025 06:28:06 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NzL893b1; spf=pass (imf15.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738823286; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=cLHfFObBbp/JIDGiZPk7EnDOW+mFjM9blpl5Rw/EvNI=; b=J6d4TDDdkbCeP4+ynOCQbFRwiGo/HBUqgiiDBBgS83xKG10JwCPitNkaJmVQS0P3hpYeZX P3Q4BYc7F1JsINiY6wP6ZS5AOsKhOygAKxdQIFS8TWwROoXSClzpTkHG7qVEyb0ay5Ncqm qQxFI8udReIlOdoAvo91sAe5FDGhTrI= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NzL893b1; spf=pass (imf15.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738823286; a=rsa-sha256; cv=none; b=oyrjKM5QR77hWJuRvv8+GgjWSb1+b7/vZPx7fcFneCL/EnQnGO3Ly7RuC0DH4QaZvLC96Q 0bzANoIgGHgUj8/VnZJEcAkz1HXwj27CxI65NgbwTptV9UCs13JG3sQB2WioW1j2apfm0G /P9wDkNu7ytxgGC6ZvEDiGnNWdz5iBE= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 956755C6F6C; Thu, 6 Feb 2025 06:27:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC7C3C4CEDD; Thu, 6 Feb 2025 06:28:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738823285; bh=0Fn2cLRgxvxvLS5p2V3DfVAHIHe9oV4dus+/QtcCaBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NzL893b1mj6iPva/1U9W4FLmyz0frrWv8kLwPRSVKO+vhptmf5Zn0XZQdkFTQLZ5i ZQaKoRcZe6o9OI+6XwBT8V5dBq/jftIEFA1sidpV60xFiFCXc53kkwSLxHWpi3FrW8 UXu8d7F+bd6xHvdUL2Mq/sCspCgd96pw8eZiP3hXCym92pu6fGjLBeUrjVOXnEpKVj KjKJLqUhfVP8/ah318AUNET+7q7t1EcYkGnkVi56ZQUCEL7lrDFLkeSwl/0cQRpRJL c2FekF9hLX0GS7vcO8ptogh43xIoGPyYRNz7n1Dwt+lKQ+zlRfN2aZ28f66y8BsMjV lLMpX0eh6vQeQ== From: SeongJae Park To: SeongJae Park Cc: Lorenzo Stoakes , "Liam R. Howlett" , Davidlohr Bueso , Andrew Morton , David Hildenbrand , Shakeel Butt , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC PATCH v2 4/4] mm/madvise: remove redundant mmap_lock operations from process_madvise() Date: Wed, 5 Feb 2025 22:28:01 -0800 Message-Id: <20250206062801.3060-1-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250204195343.16500-1-sj@kernel.org> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3F8E9A0002 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: fnn87zsbqb8cgfsjs4crbdrbtu5tnc89 X-HE-Tag: 1738823286-304014 X-HE-Meta: U2FsdGVkX19vc0MB58Ovs36f1cIm5lMBuUD3CTtyxdCTbnEjPTUzuZMJsdsqVhoURvyQGM3HdV4wyH3MLVzTLXpwJSYwmtSjOTunPm53roueiRuI7t4ihBfTNR4Gj1EGWgY/dhAoc/7pEEzmtKE3IA5v8e7Dgl67TTBbNWrplW2c301zVr3PUg2F1vsLf4n0+GWoTps10g9i0juPjXWZGiD11eChs0UBaqWyWNDCDmjUgRVZCIbo9gvog2J4bB0sEjcK/kS7WuYS5Q+k3qqxBHkBG7VVi5ElLU+vqeKrg1cXuLLnyNaRBLdPHvak9esR5lNig2+/N4a5o57YGb/F0adOD3/1RdXxpCqQWzGoRCFm1y4kPdiJth0eBoHSg+4WPTRuWSb6GwVbi7qRqres9OUqWEn5Qnk1ho33DpQApdjymGIEwfABpgx8izkesgp2y8emaRebvyY8cey24d63lTHvOsn+KSXzEde8se55xfn0Ne1bg2sMhyynvLV485RcM/nqHgh9DOvMEO+oChC36B8SmPfrRIGNBdCtDanX3EwUGFFff/ROJs8ci3djgSwwH+SUVVcX0C4kblS2+U7+ogc0PUtg9Bwv3ARXWhkqIdrcA4fp6gbG7YmbiezrLxS2tVoLz/ttj7JJkzLCCWQjb5VmwIlTuZ+d0ZhbIPxuwkQ6DP1aW0fcQmRUpI27q2clzi5LQtKnGhUKIYkb0vNh9BGqB8KZ1lgAy/9BGkxx4Qv33p5PGrohv3BjK1o3tI52UBsIetdWHpSW3KzoKLbgVTtV8w2yGiTffzLxXZP/lE5MqTtNl5yycr6gs5K12nyKt84V9U9cbezFPxzambVSb9gjV+wcukDJCka6qY9fXubYSfVU3Nqn/LfkOj0hf+Ei43EuhUM1kmmQx5emEqHnon+I49uJ4cEJkRk0dDs+8qX7nOto5BnJuf0l1IXQl/SXCm6ifPUumSr7Hxa96ff y5L4eHam XHzssOwKjS0INSQ1SwWYN8uy6G4+iAGMAt0My+gTcXZWX5BEUS9k32dvIePiCta82M3du7CWT2CP0D6Nc80rdqK0XJAcw5JlgXf/Ab6Ymq0r5TrtR1M316PNkbFK86Ibu3EEEjuJFKV7DxyIsu6OOu+W1c2Okc8YAKYwL3kZXch0WYaFvzVeKlHABD29bYRu5jFWqnvpr1+vYetCa1O7OU7avOppE0K5yH+Jr6q57S4rj6+WdT8w67QPiISMFNTU5mlWo8v5oebpXcexEmu7PbbXgnpDGvNn8dnzhDsu6wFMDO5iTIr89WDxbH7iyGLOVm+hYx4tKqZJwgIETuIZcn0frDFqD6GV4248bORE3ZKmGv0oPgzoTlGYXJ43qOhPpYJED 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: List-Subscribe: List-Unsubscribe: On Tue, 4 Feb 2025 11:53:43 -0800 SeongJae Park wrote: > On Fri, 31 Jan 2025 17:51:45 +0000 Lorenzo Stoakes wrote: > > > On Fri, Jan 31, 2025 at 12:47:24PM -0500, Liam R. Howlett wrote: > > > * Davidlohr Bueso [250131 12:31]: > > > > On Fri, 31 Jan 2025, Lorenzo Stoakes wrote: > > > > > > > > > On Thu, Jan 16, 2025 at 05:30:58PM -0800, SeongJae Park wrote: > > > > > > Optimize redundant mmap lock operations from process_madvise() by > > > > > > directly doing the mmap locking first, and then the remaining works for > > > > > > all ranges in the loop. > > > > > > > > > > > > Signed-off-by: SeongJae Park > > > > > > > > > > I wonder if this might increase lock contention because now all of the > > > > > vector operations will hold the relevant mm lock without releasing after > > > > > each operation? [...] > > > > Keep in mind process_madvise() is not limited by IOV_MAX, which can be rather > > high, but rather UIO_FASTIOV, which is limited to 8 entries. > > process_madvise() indeed have iovec array of UIO_FASTIOV size, namely iovstack. > But, if I understood the code correctly, iostack is used only for a fast path > that the user requested advicing less than UIO_FASTIOV regions. > > I actually confirmed I can make the loop itrate 1024 times, using my > microbenchmark[1]. My step for the check was running the program with > 'eval_pmadv $((4*1024*1024)) $((4*1024)) $((4*1024*1024))' command, and > counting the number of the itration of the vector_madvise() main loop using > printk(). Please let me know if I'm missing something. > > > > > (Some have been surprised by this limitation...!) > > > > So I think at this point scaling isn't a huge issue, I raise it because in > > future we may want to increase this limit, at which point we should think about > > it, which is why I sort of hand-waved it away a bit. > > I personally think this may still not be a huge issue, especially given the > fact that users can test and tune the limit. But I'd like to hear more > opinions if available. Maybe I should wait more for the more opinions, but I just impatiently sent the next spin of this patch series[1]. Because Davidlohr and Lorenzo promised their tags based on the assumption of UIO_FASTIOV limit while I think that may not be an effective limit, I didn't add their tags on the fourth patch of the series. Please let me know if you have any concern about that, either on this thread or on the new patch series thread[1]. [1] https://lore.kernel.org/20250206061517.2958-1-sj@kernel.org > > [1] https://github.com/sjp38/eval_proc_madvise/blob/master/eval_pmadv.c Thanks, SJ [...]