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 E9A85C4320A for ; Fri, 23 Jul 2021 08:53:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D22C360EBD for ; Fri, 23 Jul 2021 08:53:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234646AbhGWINT (ORCPT ); Fri, 23 Jul 2021 04:13:19 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:43696 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234626AbhGWINS (ORCPT ); Fri, 23 Jul 2021 04:13:18 -0400 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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