Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp6918img; Thu, 28 Feb 2019 13:59:49 -0800 (PST) X-Google-Smtp-Source: APXvYqwSK/kILxm5l9e4LlqPQujSxvmI5BPIM+CJJ/APwRcMlctIxf3b34Y7ba4CNBxUeBHuMxQu X-Received: by 2002:a63:112:: with SMTP id 18mr1292405pgb.139.1551391189031; Thu, 28 Feb 2019 13:59:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551391189; cv=none; d=google.com; s=arc-20160816; b=UtrrRefcS9FJ50JgiaoZdGJXyEvSKuAgrc99iEAnzM08t9WGkrO1g9Nvg+Gvm0MNsI ny1p6sWeEYLOIlgWNIoFNhx84DjyO/OitNbZOlCililP30KiwTa0a3+8ewJqC5zYNSIb U7qoxD4SPX7TjzlYcBEoOJAdXar3LlBYFNiagDWdqVbADfpKLpTjk2iYuRmrrssFOsH/ rplAt6WYV8fLNFKVTbqg/51atpGpHUxgAhYfBs/KiUNBfrrLWj8EdW/2zy2zBQ0h3Hoa JzeWkBqw3iNpR8k01YTBkk+vCuyT5OAgubaqwL7vNfipKY+dqfAhtBpIrDST4Ov9nitg V83A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=0VA5nzNT5SRcMaUMBhDsz42bvVihu0EYjwSEkOG9g5Q=; b=eODUDF+uwhbfxEy2PY0d80NVRJLawV4WK2bC+wrVb4oc9UmFZrPj4ma7oeZ/XOeCLl QkTIa0Bxnd6v2ffgFl666/HKXmzEeGsn7yPGEI+ZGRoOadFxNohhqaivKdyLyRkdBV/k uN96jXTIXaa/raaPYGnTy2mVtNJPLa7pvqN9gMYoFHliVYltNxj3yPvA+e7Og650CKk2 pOInNXnCsxYMdlGmIgpz2V5JjV1Doai2vBLZ+1hGI7V8EK1KQCpqmoqWzR+O5iUYD9YS OunUVqwIZfoXJzRA9qN1OnKgQ1SzEFI/p0FXAdhOgQrTMkhdD4uTcuSmHWn+HVxn+wLC Fs4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=MKT4yReb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v189si17707639pgd.527.2019.02.28.13.59.33; Thu, 28 Feb 2019 13:59:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=MKT4yReb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387885AbfB1UoZ (ORCPT + 99 others); Thu, 28 Feb 2019 15:44:25 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:45972 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732794AbfB1UoZ (ORCPT ); Thu, 28 Feb 2019 15:44:25 -0500 Received: by mail-lj1-f196.google.com with SMTP id d24so18123369ljc.12 for ; Thu, 28 Feb 2019 12:44:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0VA5nzNT5SRcMaUMBhDsz42bvVihu0EYjwSEkOG9g5Q=; b=MKT4yRebQ3XFwrUgwZj0QnrXisDJlO0UL9Q7vtfrKVi31aTJqkFhmffN4noz3wl8I7 pwB5dNW0mTF7qpEuFPA4c8BoOCxpMB0G7qFHbP9Fb2QTeJ407bwlyj8py0jYNEOPbk/w JP7OB8Bm79VW37NCiFqhk7JvkyN68p3U2b4wc= 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=0VA5nzNT5SRcMaUMBhDsz42bvVihu0EYjwSEkOG9g5Q=; b=gkE1Eh7V9Z/1sZLhvl45oyU3k9xEX31KUMMdgcQLYiHKEHjnKS/ZZmUYAXnjzsa57V DzzJVcLjb7onYl13zZSe0XT0+U4IKe13KX8xQA48HQfnQRLQMmU48zfvhDAWTbdywRQk b1QwMpxn+tv/jizSPflZ9gUuRKRDNkxF8pxX37Ys6ALpFjeVYInlN208wHuLnv3Eicwl ek74BEfv+yuUbzzFKNVHjLEkAt4fW9PtpJa6FsbrUmE8CWP08E0orMVJN96OBur7btLw ZaYTLlOayJlRqMceEriBD4El3Xex5rGi6ZSGPEZLAarcqCqCrTICBRve3O9BBHsbGZ4K ioVA== X-Gm-Message-State: APjAAAXApfDz+erD6Bk7HvHPVoBLER0On7hIDzMbooOEQbn5UOAMkNXV QrqtG9Z3xfJknZ1Au0FLjbb0wlE/9T3EpgRRKTw7pg== X-Received: by 2002:a2e:850a:: with SMTP id j10mr555683lji.102.1551386663347; Thu, 28 Feb 2019 12:44:23 -0800 (PST) MIME-Version: 1.0 References: <20190226091314.18446-1-osalvador@suse.de> <20190226140428.3e7c8188eda6a54f9da08c43@linux-foundation.org> <20190227213205.5wdjucqdgfqx33tr@d104.suse.de> <5edcfeb8-4f53-0fe6-1e5b-c1e485f91d0d@suse.cz> In-Reply-To: <5edcfeb8-4f53-0fe6-1e5b-c1e485f91d0d@suse.cz> From: Joel Fernandes Date: Thu, 28 Feb 2019 12:44:11 -0800 Message-ID: Subject: Re: [PATCH] mm,mremap: Bail out earlier in mremap_to under map pressure To: Vlastimil Babka Cc: Oscar Salvador , Andrew Morton , linux-mm , LKML , Linux API , Hugh Dickins , "Kirill A. Shutemov" , jglisse@redhat.com, Yang Shi , mgorman@techsingularity.net Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 28, 2019 at 12:06 AM Vlastimil Babka wrote: > > On 2/27/19 10:32 PM, Oscar Salvador wrote: > > On Tue, Feb 26, 2019 at 02:04:28PM -0800, Andrew Morton wrote: > >> How is this going to affect existing userspace which is aware of the > >> current behaviour? > > > > Well, current behavior is not really predictable. > > Our customer was "surprised" that the call to mremap() failed, but the regions > > got unmapped nevertheless. > > They found it the hard way when they got a segfault when trying to write to those > > regions when cleaning up. > > > > As I said in the changelog, the possibility for false positives exists, due to > > the fact that we might get rid of several vma's when unmapping, but I do not > > expect existing userspace applications to start failing. > > Should be that the case, we can revert the patch, it is not that it adds a lot > > of churn. > > Hopefully the only program that would start failing would be a LTP test > testing the current behavior near the limit (if such test exists). And > that can be adjusted. > IMO the original behavior is itself probably not a big issue because if userspace wanted to mremap over something, it was prepared to lose the "over something" mapping anyway. So it does seem to be a stretch to call the behavior a "bug". Still I agree with the patch that mremap should not leave any side effects after returning error. thanks, - Joel