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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37D52C432BE for ; Fri, 23 Jul 2021 08:53:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E8C1060E78 for ; Fri, 23 Jul 2021 08:53:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E8C1060E78 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 87A326B005D; Fri, 23 Jul 2021 04:53:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 82BBA6B006C; Fri, 23 Jul 2021 04:53:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 740856B0070; Fri, 23 Jul 2021 04:53:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0181.hostedemail.com [216.40.44.181]) by kanga.kvack.org (Postfix) with ESMTP id 5DD746B005D for ; Fri, 23 Jul 2021 04:53:53 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 033E620312 for ; Fri, 23 Jul 2021 08:53:52 +0000 (UTC) X-FDA: 78393239946.04.B75F63F Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf05.hostedemail.com (Postfix) with ESMTP id 6DF905018958 for ; Fri, 23 Jul 2021 08:53:52 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 03E181FF64; Fri, 23 Jul 2021 08:53:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1627030431; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JLSkPVb0qmdjS8aLyMRIbeEymJYhZrsklJC7sIwz+zk=; b=FTrHQ2b85dXEcFaDdqgXGkWUWLZf5DCjTR8B6ODPFpAy+R/2uREN3c18+Broig0Y9yWZrQ XqzkNywyBSZHM3ncLxRR+QrqjZEO1HFwSuPO9xWU5TYS5DIvDGBSFpgMlxpqClwAHOBTwg 3lqto1PMPWXEBgWczPQ8yh6paQdcfjI= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id CEF52A3B9A; Fri, 23 Jul 2021 08:53:50 +0000 (UTC) Date: Fri, 23 Jul 2021 10:53:50 +0200 From: Michal Hocko To: Suren Baghdasaryan Cc: Shakeel Butt , Andrew Morton , David Rientjes , Matthew Wilcox , Johannes Weiner , Roman Gushchin , Rik van Riel , Minchan Kim , Christian Brauner , Christoph Hellwig , Oleg Nesterov , David Hildenbrand , Jann Horn , Andy Lutomirski , Christian Brauner , Florian Weimer , Jan Engelhardt , Tim Murray , Linux API , Linux MM , LKML , kernel-team Subject: Re: [PATCH v3 1/2] mm: introduce process_mrelease system call Message-ID: References: <20210723011436.60960-1-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 6DF905018958 Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=FTrHQ2b8; spf=pass (imf05.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Stat-Signature: xgo8madzfnd6cw6f5y3wb7bf8g3uxcpn X-HE-Tag: 1627030432-449559 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 Fri 23-07-21 01:11:51, Suren Baghdasaryan wrote: > On Thu, Jul 22, 2021, 11:20 PM Michal Hocko wrote: > > > On Thu 22-07-21 21:47:56, Suren Baghdasaryan wrote: > > > On Thu, Jul 22, 2021, 7:04 PM Shakeel Butt wrote: > > > > > > > On Thu, Jul 22, 2021 at 6:14 PM Suren Baghdasaryan > > > > wrote: > > > > > > > > > [...] > > > > > + > > > > > + mmap_read_lock(mm); > > > > > > > > How about mmap_read_trylock(mm) and return -EAGAIN on failure? > > > > > > > > > > That sounds like a good idea. Thanks! I'll add that in the next respin. > > > > Why is that a good idea? Can you do anything meaningful about the > > failure other than immediately retry the syscall and hope for the best? > > > > I was thinking if this syscall implements "best effort without blocking" > approach then for a more strict usage user can simply retry. I do not think we really want to promise non blocking behavior at this stage unless that is absolutely necessary. The current implementation goes an extra mile to not block but I wouldn't carve it into stone via userspace expectations. > However > retrying means issuing another syscall, so additional overhead... > I guess such "best effort" approach would be unusual for a syscall, so > maybe we can keep it as it is now and if such "do not block" mode is needed > we can use flags to implement it later? Yeah, an explicit opt-in via flags would be an option if that turns out to be really necessary. -- Michal Hocko SUSE Labs