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 8262DC10DAA for ; Thu, 30 Nov 2023 13:32:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 060696B046B; Thu, 30 Nov 2023 08:32:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 010566B046C; Thu, 30 Nov 2023 08:32:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E42D66B046D; Thu, 30 Nov 2023 08:32:27 -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 D5E616B046B for ; Thu, 30 Nov 2023 08:32:27 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B2970A0283 for ; Thu, 30 Nov 2023 13:32:27 +0000 (UTC) X-FDA: 81514709934.06.56C60EC Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf20.hostedemail.com (Postfix) with ESMTP id 9DBE31C002E for ; Thu, 30 Nov 2023 13:32:25 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf20.hostedemail.com: domain of alexandru.elisei@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=alexandru.elisei@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701351146; 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; bh=JEKNj+ruHYyJ8669AYqGE7FfYjvQ74djZNcC/FMfZFc=; b=FKekJyxBPAmBW6nfLAuzjQiLrIfVCmb5a7ep0cupt5eXYdjVrAVpuLcaxMiTxACSJ7zcNt 4I+jWtwsGYwaQOJ1lunQT8B0F6+yxLATKpgL1wE0IOuxuug4fJoSPA24MWDL8kHoIK9Elo 7m7OJpjJt49aQVR6C+pEuFY3vsamvmg= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf20.hostedemail.com: domain of alexandru.elisei@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=alexandru.elisei@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701351146; a=rsa-sha256; cv=none; b=EdJ9bHIbbD72JteF9XNamy+68qHgMv/sXxCKI7FXkCLJWIz4+FBNump3wPRo3IPBNahwna BuO928e7TtsKoUq9DNTNVe8lGN9/O0cstIy19JX3fMfBYAKb1WsciJSMXnU2yOm7FPJyv2 4DDQvvWb2nfcgIwSIQ+bRev0Bq/O55A= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CA30DC15; Thu, 30 Nov 2023 05:33:10 -0800 (PST) Received: from raptor (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 415D63F5A1; Thu, 30 Nov 2023 05:32:19 -0800 (PST) Date: Thu, 30 Nov 2023 13:32:16 +0000 From: Alexandru Elisei To: David Hildenbrand Cc: Hyesoo Yu , catalin.marinas@arm.com, will@kernel.org, oliver.upton@linux.dev, maz@kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, arnd@arndb.de, akpm@linux-foundation.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, mhiramat@kernel.org, rppt@kernel.org, hughd@google.com, pcc@google.com, steven.price@arm.com, anshuman.khandual@arm.com, vincenzo.frascino@arm.com, eugenis@google.com, kcc@google.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org Subject: Re: [PATCH RFC v2 19/27] mm: mprotect: Introduce PAGE_FAULT_ON_ACCESS for mprotect(PROT_MTE) Message-ID: References: <20231119165721.9849-1-alexandru.elisei@arm.com> <20231119165721.9849-20-alexandru.elisei@arm.com> <20231129092725.GD2988384@tiffany> <4e7a4054-092c-4e34-ae00-0105d7c9343c@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4e7a4054-092c-4e34-ae00-0105d7c9343c@redhat.com> X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 9DBE31C002E X-Stat-Signature: na13r7rsx3q4t3b83i1yssaj3wwbcbcq X-HE-Tag: 1701351145-208409 X-HE-Meta: U2FsdGVkX19guxJc3HPS8IxW25ZTh2GrvsH9at8h1Fzq8qment6KTcRYJR6KPmUCd64tfS25G2h4UHL0LsAYduLOXq5mLBfW5FgP1UMFsJLcfCHrIhNYoES1L0qU81fcipmbGMq7RfffBo2z+lVvZXAo8XKOjv2y06Yd8Rw2/QskUJn9UNccR7PCPwbFPnH1erhDO2y7zHSpKkdypZekICPeDQR7IsG3tIH1kHKSTvWw0D6vYfA6zyfDUkVzCApVuW64YN37eXw6hDsrLbtXLuE3mbXe/FYP9DGDroO89YJfHUWkIgdQEeoYrU1KybUYASvqCyEKmOu+dmlsuBaxkWrLPwlUPR9Z/m792fHmhjn3Kn8XI5LwxzbymWvRq3Akzu4DvkPg3jaLSWV/AbtOTDGEQmye7mW3WIFoIMOwPWlOHcKzz4P15TFeIGq01M5cahOsElnhL8C6qeonCdDkb0pV5aUzbeUikqG8DPdCEKWVaM8JgevMGofP7SNGmlI1saK+9nzUc0bpKWvukynNjnOMjUcPb/y9YxRdoVBz8N3R04W6j7aAA1hwBOyzKqWDaHKKafp4ozeQs3MskXZ5Ok7tQHOjtyjjxN73nSa30JyK0IvADcyyg2ch8L7NcawNyb+o4z6f1hn97epm2pnsHdYKwq58I/4uMrielwJRKqoAcoqdQCN86fMMk7IOEqupdpW8xLR2mHo58CslF/UdmsiK1M35Z6YWfTTnskznLTaMHlU5SulCaQyPkF2Blz2+BHD59tljcPwnRKaOo0gytokP8CgRlqecLVduIg9698RuPPxcTOlro3ikU/s0ujOnTTdVeQYDCg7V0DkJXp13AJsUuDJU3xx90DMoPeFWhL2k85GSkfY+G3kIb03PyMyDYd1B3ybMzzWZfPMm1ttjbeIDNJtbusGQL6ovKbVYfrxXeRQbWvmfR2MKbddIycYq68DTPJWpN7FWLV2Vubh Jw6zZbsc mZBGr0+t5Vm04aZ8D6Whvh0uHbE8VZKFcAr0YECRSGXZW1TraqtWRNM/hP6cI34fjMzbqg1Npb1ikBFdz7COwXyxE7BhmE98TJYF8wy2MqbFU0fgkt6+t/WalTMf+bsvaQIUL3JAGMo/b/k4+XUTijObk/A== 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: Hi, On Thu, Nov 30, 2023 at 01:49:34PM +0100, David Hildenbrand wrote: > > > > + > > > > +out_retry: > > > > + put_page(page); > > > > + if (vmf->flags & FAULT_FLAG_VMA_LOCK) > > > > + vma_end_read(vma); > > > > + if (fault_flag_allow_retry_first(vmf->flags)) { > > > > + err = VM_FAULT_RETRY; > > > > + } else { > > > > + /* Replay the fault. */ > > > > + err = 0; > > > > > > Hello! > > > > > > Unfortunately, if the page continues to be pinned, it seems like fault will continue to occur. > > > I guess it makes system stability issue. (but I'm not familiar with that, so please let me know if I'm mistaken!) > > > > > > How about migrating the page when migration problem repeats. > > > > Yes, I had the same though in the previous iteration of the series, the > > page was migrated out of the VMA if tag storage couldn't be reserved. > > > > Only short term pins are allowed on MIGRATE_CMA pages, so I expect that the > > pin will be released before the fault is replayed. Because of this, and > > because it makes the code simpler, I chose not to migrate the page if tag > > storage couldn't be reserved. > > There are still some cases that are theoretically problematic: vmsplice() > can pin pages forever and doesn't use FOLL_LONGTERM yet. > > All these things also affect other users that rely on movability (e.g., CMA, > memory hotunplug). I wasn't aware of that, thank you for the information. Then to ensure that the process doesn't hang by replying the loop indefinitely, I'll migrate the page if tag storage cannot be reserved. Looking over the code again, I think I can reuse the same function that migrates tag storage pages out of the MTE VMA (added in patch #21), so no major changes needed. Thanks, Alex > > -- > Cheers, > > David / dhildenb > >