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=-10.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL 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 BF730C4338F for ; Fri, 23 Jul 2021 08:12:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1DB2660F21 for ; Fri, 23 Jul 2021 08:12:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1DB2660F21 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 6AE626B005D; Fri, 23 Jul 2021 04:12:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 65E3B6B006C; Fri, 23 Jul 2021 04:12:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 574326B0070; Fri, 23 Jul 2021 04:12:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0130.hostedemail.com [216.40.44.130]) by kanga.kvack.org (Postfix) with ESMTP id 3AA266B005D for ; Fri, 23 Jul 2021 04:12:05 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id DB28C180AD82F for ; Fri, 23 Jul 2021 08:12:04 +0000 (UTC) X-FDA: 78393134568.26.2A67D74 Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by imf30.hostedemail.com (Postfix) with ESMTP id 93D6AE002121 for ; Fri, 23 Jul 2021 08:12:04 +0000 (UTC) Received: by mail-yb1-f177.google.com with SMTP id z18so1064203ybg.8 for ; Fri, 23 Jul 2021 01:12:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=C1qEzdqI6Jn/FVHl34Kgu7Jwb4uosG+4VhGptZnZrvg=; b=jZPXf8qzB9qq5CAF+SLpq3y6yGwGY8EMcCX3geIOPQ5g0uuYf4bdWNE07VOlzOZ2EA Fp/abaP1kipLGAcyS7y7RcxDeJmC3QHjlifRQ4BRWXOi8uHKf70w0Czph0und5Lo97c0 FmjnxPWs5FBgBdsDozat1AzrzWYAiJ5ckM03RYa+D+JZ8RBDLTbAjUDuVdgG8tKmesj0 RQybNnvbGkYG714v5JmrrUBCIvwfWsEIpMLH1dH9sHgb1PtqB99hVLQyArFxofYi6xQD 1dtqqQxFEIjwVX700JCXpq++EcRKOJR3XgGOhLD+jrjiRDa0I98PAG/QcQ5a4Qv6aJtg XZKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=C1qEzdqI6Jn/FVHl34Kgu7Jwb4uosG+4VhGptZnZrvg=; b=f5lbTSIgk3RvQem6QkXoU2YBG+DrWnZ1MoKUo/XW2KwnPoHlF3NdrYfxDXV5eErUsS 2UQ/xitt1UFNcaT12yP+4v7LamgMlf3ie1XNTp0+n4JTCvVoEgqcQtUwIv/eFnY0wcS5 MNEK6/S4k/Xu855cDsR0vR0JT/o1fLeLyYE2Vb6wPc0QIawvnwXvIZDothrSMQ6gnDTd aet4CZpvnwXXUnK8VsURW1QEHfosFNsLuMrp+8jSCkzfbBBp1lNOACkEuehgStYGPEEM NjKutt02lioJjtMGJ+b0dV40bXBNBV1CpEohZrVIKyFvqP8GMkCCh5q8rRvbbVCmPfOM Q9HA== X-Gm-Message-State: AOAM532Ehib2AAdGRMHJrAxQ7i/A2jjswXn1haG+iA2IIZj8l7oGFawM S3lqE+99lF3cZQ5dPdENp7WMNG0yNYGCxxlgy1Xg1w== X-Google-Smtp-Source: ABdhPJxLcGOAglk1xmdYhQaejVf+VP1cQ6fdFJ9PAmHI4eedfS1dNJ9YICT5Pt+ugHWzsZ25h9WrBLwMWNrFvtoVyvc= X-Received: by 2002:a25:49c2:: with SMTP id w185mr3535281yba.294.1627027923531; Fri, 23 Jul 2021 01:12:03 -0700 (PDT) MIME-Version: 1.0 References: <20210723011436.60960-1-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Fri, 23 Jul 2021 01:11:51 -0700 Message-ID: Subject: Re: [PATCH v3 1/2] mm: introduce process_mrelease system call To: Michal Hocko 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 Content-Type: multipart/alternative; boundary="0000000000006ce0fa05c7c5f51e" Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=jZPXf8qz; spf=pass (imf30.hostedemail.com: domain of surenb@google.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 93D6AE002121 X-Stat-Signature: r5mtqu79o6usj8acwr3u3a6xcw3e7ynj X-HE-Tag: 1627027924-74682 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: --0000000000006ce0fa05c7c5f51e Content-Type: text/plain; charset="UTF-8" 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. 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? > -- > Michal Hocko > SUSE Labs > --0000000000006ce0fa05c7c5f51e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Thu, Jul 22, 2021, 11:20 PM Michal Hocko <mhocko@su= se.com> wrote:
On Thu 22-07-= 21 21:47:56, Suren Baghdasaryan wrote:
> On Thu, Jul 22, 2021, 7:04 PM Shakeel Butt <shakeelb@go= ogle.com> wrote:
>
> > On Thu, Jul 22, 2021 at 6:14 PM Suren Baghdasaryan <= surenb@google.com>
> > wrote:
> > >
> > [...]
> > > +
> > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mmap_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 re= spin.

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 wa= s thinking if this syscall implements "best effort without blocking&qu= ot; approach then for a more strict usage user can simply retry. However re= trying 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 no= t block" mode is needed we can use flags to implement it later?
<= div dir=3D"auto">


--
Michal Hocko
SUSE Labs
--0000000000006ce0fa05c7c5f51e--