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=-2.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 18A86C33CAA for ; Mon, 20 Jan 2020 14:21:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C4EFD22525 for ; Mon, 20 Jan 2020 14:21:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="yCf8eijx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C4EFD22525 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 73A366B0674; Mon, 20 Jan 2020 09:21:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6EA256B0675; Mon, 20 Jan 2020 09:21:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D8B46B0676; Mon, 20 Jan 2020 09:21:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0056.hostedemail.com [216.40.44.56]) by kanga.kvack.org (Postfix) with ESMTP id 472FA6B0674 for ; Mon, 20 Jan 2020 09:21:34 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id E600C8248047 for ; Mon, 20 Jan 2020 14:21:33 +0000 (UTC) X-FDA: 76398225666.30.field83_d91ba03e4a34 X-HE-Tag: field83_d91ba03e4a34 X-Filterd-Recvd-Size: 6084 Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Mon, 20 Jan 2020 14:21:33 +0000 (UTC) Received: by mail-lf1-f68.google.com with SMTP id 203so24186771lfa.12 for ; Mon, 20 Jan 2020 06:21:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=JXShFQ0oblTBfvPtqqTvc94TmQn0BCw/PupNhNwEy2g=; b=yCf8eijxwY8WwDB2/Xb0a5xkddKP7t+aYeipLHveuhL3muN/Xss5zfR1qKSEIs3Qpo HADp0UzQj1i5pfw/c6o41NSrOGJ56UcXRSR4M5niAv6hNU+e3pt7ZnoOfL2L4KF2Uof8 myQaNJ16F/2FqV4s0es47Wqy6khsUCKjK6UokmpMYJvXcqN/VDSp/JEeAFuJJJ4Fem5f Bckb4EpS+8Ie5mB3xCW7mFQckXmrxAtapkcKdd+yS2u/BjxFfi1qWs9YDCg+Xq/4ZQrU aD3ZFFSIM3vj4iro/AjcUB5BEU3YqYI2sCPT+UkwbQhbaVR+cLQ0ZFjcZNYrvCTPeVW1 1FJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=JXShFQ0oblTBfvPtqqTvc94TmQn0BCw/PupNhNwEy2g=; b=K7zJcXtwnDyWxP2GFPYMG7vv8suObkmdjvWT2ZsKui2hmUu3XcWxgMyBCHRbmB/TgH HayBj5JD6X1tYoz5BM2njhxDZLY650DwO0LW0FxENVZSlVyidPHXQ2B0VufwuxeZuakc O51olSmZlLw7T9jmuXapSDkdsVkyitmi12czvM6+BwE5mrCT/YOPl9onnJBUHjONvskj X9fxSeoI4CqI+yZ2b6yzf4TO26v+FGUe213Kxr6HN8O+gWge6tyEezWZtoMPqjZFYOcr ku1w9tBpb7vGBWUil4NnY9ckchTJNRwksUEuZ295FvVd6LF/AirqMF3HS4gVzO7cGEg8 wlkw== X-Gm-Message-State: APjAAAUhZGVnbPPSPZ8QS8PxI9mwqgNYHp5uy68rRenuut9vOOo4L8fR Wa7Yr2IO6zu1v/ZbAy7CAqci3w== X-Google-Smtp-Source: APXvYqw85OfgCXSwLFzcIjd4qIUW/Jrpb1WW0f9nf0Yms9qWwNXycwAOoHvOilI4y/sT5u6cX4I/gQ== X-Received: by 2002:ac2:4884:: with SMTP id x4mr13867121lfc.92.1579530091868; Mon, 20 Jan 2020 06:21:31 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id z13sm16924732ljh.21.2020.01.20.06.21.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2020 06:21:31 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id 2607210013E; Mon, 20 Jan 2020 17:21:32 +0300 (+03) Date: Mon, 20 Jan 2020 17:21:32 +0300 From: "Kirill A. Shutemov" To: Michal Hocko Cc: Kirill Tkhai , Minchan Kim , Andrew Morton , LKML , linux-mm , linux-api@vger.kernel.org, oleksandr@redhat.com, Suren Baghdasaryan , Tim Murray , Daniel Colascione , Sandeep Patil , Sonny Rao , Brian Geffon , Johannes Weiner , Shakeel Butt , John Dias , christian.brauner@ubuntu.com, sjpark@amazon.de Subject: Re: [PATCH v2 2/5] mm: introduce external memory hinting API Message-ID: <20200120142132.srf4igph4zmecu7b@box> References: <20200116235953.163318-1-minchan@kernel.org> <20200116235953.163318-3-minchan@kernel.org> <20200117115225.GV19428@dhcp22.suse.cz> <20200120112722.GY18451@dhcp22.suse.cz> <20200120123935.onlls7enjtzenbvt@box> <20200120132405.GF18451@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200120132405.GF18451@dhcp22.suse.cz> User-Agent: NeoMutt/20180716 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 Mon, Jan 20, 2020 at 02:24:05PM +0100, Michal Hocko wrote: > On Mon 20-01-20 15:39:35, Kirill A. Shutemov wrote: > > On Mon, Jan 20, 2020 at 12:27:22PM +0100, Michal Hocko wrote: > > > On Mon 20-01-20 13:24:35, Kirill Tkhai wrote: > [...] > > > > Even two threads on common memory need a synchronization > > > > to manage mappings in a sane way. Managing memory from two processes > > > > is the same in principle, and the only difference is that another level > > > > of synchronization is required. > > > > > > Well, not really. The operation might simply attempt to perform an > > > operation on a specific memory area and get a failure if it doesn't > > > reference the same object anymore. What I think we need is some form of > > > a handle to operate on. In the past we have discussed several > > > directions. I was proposing /proc/self/map_anon/ (analogous to > > > map_files) where you could inspect anonymous memory and get a file > > > handle for it. madvise would then operate on the fd and then there > > > shouldn't be a real problem to revalidate that the object is still > > > valid. But there was no general enthusiasm about that approach. There > > > are likely some land mines on the way. > > > > Converting anon memory to file-backed is bad idea and going to backfire. > > I didn't mean to convert. I meant to expose that information via proc > the same way we do for file backed mappings. That shouldn't really > require to re-design the way how anonymous vma work IMO. But I haven't > tried that so there might be many gotchas there. > > There are obvious things to think about though. Such fd cannot be sent > to other processes (SCM stuff), mmap of the file would have to be > disallowed and many others I am not aware of. I am not even pushing this > direction because I am not convinced about how viable it is myself. But > it would sound like a nice extension of the existing mechanism we have > and a file based madvise sounds attractive to me as well because we > already have that. If the fd cannot be passed around or mmaped what does it represent? And how is it different from plain address? -- Kirill A. Shutemov