Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2562779ybh; Mon, 9 Mar 2020 08:21:08 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu0GtLi7mmc63Jc1tjns2u7BCeNbpLdCAOEzTK4c7uRoX8Kp1WzWjD/kGUXnLR3ZLCzM7sZ X-Received: by 2002:aca:f18:: with SMTP id 24mr1611660oip.145.1583767268739; Mon, 09 Mar 2020 08:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583767268; cv=none; d=google.com; s=arc-20160816; b=UA+g+CHMk0bNHgtWcZbIK+7jdmIODo68e5QZrY61aCDnxhJj03pDoUSRZVPQbySQU4 HSagKX7acgWxbLLsgpCFIXPbpd72GzKtOaEjYjBKELUbC+ltzpH2ulyg6gSob1B5Zxgo 32gG+3ApVXo6tIgZ+1tNKHbSCB/ptYlL+AIA3ImTFY6iX1iAWFgl9BuQT5ROhwQgC/e5 LQhAzL8P3Dj9eT1SCHI4yMxePEWeuw3uHBOVN0wNwRNUsNlgHtvXWzapgS6+zvl4mJ06 J2xLBis9gDqvQnqY3aC3kcrblCKrKOqcDSkw0Y89D/0c9AZhj0on3l2ixdry3m5eGzAY lKoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=h/SV7acAIkFFySVIGC5SqbEA3QLMLQnR0tuQ2YopQFU=; b=hVxhFX5VavJXX2h7A6dmoEtDux+pO7cK0W3Aln7Zdi5vLODoMLoSKgLRAXqYv2H1SZ ujWyTxqn3UvXklSCAnTd/o1D5wvPPLE/eAZ9OKEVlqrU5Ot17QkctdNS/0g4i5K+Xt5w ugcv64kPPvyOxlec43mHFihnJdojVO0pEVkVfm3G7oE5AXciRaMmUGITzLF5bEKH2j7i Crzafks24VBFw1VcuXihts91NH44HFwSt3LZxN4TtGYdttOvEWSeg/+lfAqihvxfORz3 V+5SniKafI3604UXpxzoIbklI7PcYZ85qThUW4PETu8aMzteqCB/0k1QXAnASyOmHTbi rQdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BOih5r5m; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m4si343623otn.175.2020.03.09.08.20.56; Mon, 09 Mar 2020 08:21:08 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=BOih5r5m; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727054AbgCIPTi (ORCPT + 99 others); Mon, 9 Mar 2020 11:19:38 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:58952 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726958AbgCIPTh (ORCPT ); Mon, 9 Mar 2020 11:19:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583767177; h=from:from:reply-to:subject:subject: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=h/SV7acAIkFFySVIGC5SqbEA3QLMLQnR0tuQ2YopQFU=; b=BOih5r5m6/VFe/HqI3k2xnN9ZbmVx9SLSnepGY430GBJHVkyYeBSqe04O8Praw3h20PFhr bPVyT3ixfldrIZV45syxFcEaiwO73+2iZTJ/QvHuv5yQuPV9zZb+ZthwaEtvAHYz8lKF0R CjZ+s5/BGhDA/mY+cvoBem9QPd0691g= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-458-7NrhzbGVMXKSdZMTxRwW7A-1; Mon, 09 Mar 2020 11:19:35 -0400 X-MC-Unique: 7NrhzbGVMXKSdZMTxRwW7A-1 Received: by mail-wm1-f71.google.com with SMTP id x7so923435wmi.4 for ; Mon, 09 Mar 2020 08:19:34 -0700 (PDT) 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; bh=h/SV7acAIkFFySVIGC5SqbEA3QLMLQnR0tuQ2YopQFU=; b=hRzcqIs9GhVGoRiDOZNld4j7AhhA9ohn2PcHQCBPRyAlHbm9JbAxj+PDFh4gmVqcw5 5GqAUc8sik7gEAlVxU+FllS4hUnCScK/pMnqyGIbDudsn+YZqv3yLoNt1Dd8rugijSiV hpt9egJiCcnKk8PxDgume9UPOrtkCGv30Wd/PJjthZJgT2o7A6wDLvh89JOX7xiJmXGW 4QBLGa7TUA1RrlA0YOlEUrlxMWRkd2hwUmy1PH4yIvZnjeYBY+DdjE4LakjIB1DKvsfZ Gsuai2caQ8Q5NbLnWpUpMMo5dUpjU1FZQPGH+9bwrGv2fTQhNUC0oKoVC9AGbaYvXMTF /bmA== X-Gm-Message-State: ANhLgQ0aZgJ4baW0WHFOPvyqhQheo43taEFfYYIVzL8fMp+9LrDFdLiF XJUB1EBvbVlg2yI9gCekBJgkZcZmrBJD34oqrTCJEwLeNnQE7ZwAyhKlEhblVPFeKVRRuR6SyEu X/uyMARoN81ZLeGKl2FiQFMLn X-Received: by 2002:adf:e98f:: with SMTP id h15mr22025414wrm.263.1583767174026; Mon, 09 Mar 2020 08:19:34 -0700 (PDT) X-Received: by 2002:adf:e98f:: with SMTP id h15mr22025397wrm.263.1583767173814; Mon, 09 Mar 2020 08:19:33 -0700 (PDT) Received: from localhost (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id f127sm26539134wma.4.2020.03.09.08.19.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2020 08:19:33 -0700 (PDT) Date: Mon, 9 Mar 2020 16:19:32 +0100 From: Oleksandr Natalenko To: Michal Hocko Cc: Vlastimil Babka , Minchan Kim , Andrew Morton , LKML , linux-mm , linux-api@vger.kernel.org, Suren Baghdasaryan , Tim Murray , Daniel Colascione , Sandeep Patil , Sonny Rao , Brian Geffon , Johannes Weiner , Shakeel Butt , John Dias , Joel Fernandes , Jann Horn , alexander.h.duyck@linux.intel.com, sj38.park@gmail.com, SeongJae Park Subject: Re: [PATCH v7 7/7] mm/madvise: allow KSM hints for remote API Message-ID: <20200309151932.6sjwq6bucbu6zsea@butterfly.localdomain> References: <20200302193630.68771-1-minchan@kernel.org> <20200302193630.68771-8-minchan@kernel.org> <2a66abd8-4103-f11b-06d1-07762667eee6@suse.cz> <20200306134146.mqiyvsdnqty7so53@butterfly.localdomain> <20200309131117.anvyjszaigpoz2kp@butterfly.localdomain> <20200309150815.GR8447@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200309150815.GR8447@dhcp22.suse.cz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 09, 2020 at 04:08:15PM +0100, Michal Hocko wrote: > On Mon 09-03-20 14:11:17, Oleksandr Natalenko wrote: > > On Fri, Mar 06, 2020 at 05:08:18PM +0100, Vlastimil Babka wrote: > [...] > > > Dunno, it's nice to react to signals quickly, for any proces that gets them, no? > > > > So, do you mean something like this? > > > > === > > diff --git a/mm/ksm.c b/mm/ksm.c > > index 363ec8189561..b39c237cfcf4 100644 > > --- a/mm/ksm.c > > +++ b/mm/ksm.c > > @@ -849,7 +849,8 @@ static int unmerge_ksm_pages(struct vm_area_struct *vma, > > for (addr = start; addr < end && !err; addr += PAGE_SIZE) { > > if (ksm_test_exit(vma->vm_mm)) > > break; > > - if (signal_pending(current)) > > + if (signal_pending(current) || > > + signal_pending(rcu_dereference(vma->vm_mm->owner))) > > err = -ERESTARTSYS; > > else > > err = break_ksm(vma, addr); > > === > > This is broken because mm might be attached to different tasks. > AFAIU this check is meant to allow quick backoff of the _calling_ > process so that it doesn't waste time when the context is killed > already. I do not understand why should we care about any other context > here? What is the actual problem this would solve? I agree with you, but still trying to understand what does Vlastimil mean :). > > -- > Michal Hocko > SUSE Labs > -- Best regards, Oleksandr Natalenko (post-factum) Principal Software Maintenance Engineer