Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp277494pxv; Thu, 24 Jun 2021 07:44:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwtRLuWDuzLCbj9QOhrw84die6lalS7Hq2cHoYqjIEZDZrZ4vH5vpTAXFNfg1fvNgJ5Wi/ X-Received: by 2002:a17:906:63d2:: with SMTP id u18mr5778754ejk.186.1624545859176; Thu, 24 Jun 2021 07:44:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624545859; cv=none; d=google.com; s=arc-20160816; b=F3ho70CDkw/YrVfo/fniucIxtxff+rYVvhB2g5LtHXuF+LsZTzjTr+Ew+xIpbLo3jB qucUBnrja6eIHH/Pkt79o0ZCeEd6xbIMEknhJ9qe/xsrmq9xZKS5s1WkMp4cMT7QCdHD ZJavXOqGjkOAOPLbH5EVo2bLQvJuNlRw5UBJ35UOB+5cUg6aecDJb3ypLYZirF0XPwIu j+SnCI2HN8IQweGewP1ccB0sOpSOcdbsbsTXan8djMBu06HuXK/iEK0J1q/BCcIMyUBs Wn9zOsID7NBsVGf8KultlPejj5YTKDGNKpDmaRmOOFh8V27lM5YVEoys7v3I4wahe6kL bYjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=zPDOtaL+XLEb4/llfBA4wK0O+KTaocWklfCim100ic0=; b=elcrncPQEINOsMp/X1Z4KcWZOi3vQJ9iBwxgqHs/KOsCz9lI0+wl2JYx6CTG2xL/e9 wSMTtF9c5Uied75eGbBk87HMAm0zomDXwKFT63kWW06rtEg2o9djc08MIbGD5uxD72nM 7nEmOjTqToWgAcWn8IecCftQ8+TCziBxCW+ckUiSuoIS6n+5whjwVGBhVYiAW6ODTiod K/6UZHSe5byM+Q2S8nT6wjC+7Ow9Doh9wMV10mBjUhzVc08lFzIqpRkDFb9qggHXxWoc Hz8CusAtCBEzKrlm8Mxodq6jSMzMleFyP6M68kk3UPl5Pmp5mlKYVNZkx7XECpda89Ht Dv+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=AwNSCHRt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dz15si3265879edb.281.2021.06.24.07.43.55; Thu, 24 Jun 2021 07:44:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=AwNSCHRt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232008AbhFXOpT (ORCPT + 99 others); Thu, 24 Jun 2021 10:45:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231417AbhFXOpS (ORCPT ); Thu, 24 Jun 2021 10:45:18 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18DBAC061756 for ; Thu, 24 Jun 2021 07:42:58 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id u13so10751989lfk.2 for ; Thu, 24 Jun 2021 07:42:58 -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=zPDOtaL+XLEb4/llfBA4wK0O+KTaocWklfCim100ic0=; b=AwNSCHRt5qjpDmU6yijGBadrKOXnnr9hVNiLlx/FbaOFqI7Oxqf65VBlsJ84NPRVUf Uk6MvF+XRWYMyea/gmTHmIUsLYO7xcwg9uhua6HSTwUNSWCMFDs8TG7TzLmj03SLlMLu nm+U/p9FibYIcXKi7fSqx93PopR7gtjTiBZHR3bsaYo0FD2sFQhJS5DGD3A8rJJh5InC +SOGjQ6qrQ/au6Oy7sPYBw1TPZPaqdfRUaAmVvuVuXWe2YEZ5fRR/HxaJPTbhGqJHLGE N1zbWFHepM00ofYSoqSVnrlyxnmfStngqHMx949hyPQtNpJz+7vR6NuPH/uXYf1W6sge jWiw== 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=zPDOtaL+XLEb4/llfBA4wK0O+KTaocWklfCim100ic0=; b=TJx9dHprRYOxM1jV0XcA9x3cgQzPvk1aJoaidYu07UKH59HlCSicufI7bGUNjFVp+A pa1okx0JdK3YDr8BfdC8z+cBJQN8qPta5IYBjBZGPEoLSclv1m/PSgNk0CKk4S/SX2Y+ plVxOcAqRmLjBQzg4M/frBDH50JadX6V7X/zna9KIgRv3gAkV7bqwEnDnwXhivVbIIrY dnpo4VKoDRJmglwrdVbi2XBX3qRn1rceBvmuItuhXphJSCZig3zmvue1u/GqqI0+hgoD G7kXACzjBHD7UcD3pskdcydnXOc8gAzTxoGBu7MNmLFYowA86BSurDyN+E0cSwApKQRd TyiA== X-Gm-Message-State: AOAM531x8SAxkjeI2b90VfVIp3iYGBMwLUFKKBIaSnaNZ6x/Ppy17flh T1ASRqOniI61EfkD7TBcGN8xjcdHuhUAwYmB6zBt7w== X-Received: by 2002:a05:6512:3155:: with SMTP id s21mr4064815lfi.358.1624545776093; Thu, 24 Jun 2021 07:42:56 -0700 (PDT) MIME-Version: 1.0 References: <20210624102623.24563-1-sjpark@amazon.de> <20210624102623.24563-3-sjpark@amazon.de> In-Reply-To: <20210624102623.24563-3-sjpark@amazon.de> From: Shakeel Butt Date: Thu, 24 Jun 2021 07:42:44 -0700 Message-ID: Subject: Re: [PATCH v31 05/13] mm/damon: Implement primitives for the virtual memory address spaces To: SeongJae Park Cc: SeongJae Park , Jonathan.Cameron@huawei.com, acme@kernel.org, alexander.shishkin@linux.intel.com, amit@kernel.org, benh@kernel.crashing.org, Brendan Higgins , Jonathan Corbet , David Hildenbrand , dwmw@amazon.com, Marco Elver , "Du, Fan" , foersleo@amazon.de, greg@kroah.com, Greg Thelen , guoju.fgj@alibaba-inc.com, jgowans@amazon.com, Mel Gorman , mheyne@amazon.de, Minchan Kim , Ingo Molnar , namhyung@kernel.org, "Peter Zijlstra (Intel)" , Rik van Riel , David Rientjes , Steven Rostedt , Mike Rapoport , Shuah Khan , sieberf@amazon.com, snu@zelle79.org, Vlastimil Babka , Vladimir Davydov , zgf574564920@gmail.com, linux-damon@amazon.com, Linux MM , linux-doc@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 24, 2021 at 3:26 AM SeongJae Park wrote: > [...] > > > +/* > > > + * Get the three regions in the given target (task) > > > + * > > > + * Returns 0 on success, negative error code otherwise. > > > + */ > > > +static int damon_va_three_regions(struct damon_target *t, > > > + struct damon_addr_range regions[3]) > > > +{ > > > + struct mm_struct *mm; > > > + int rc; > > > + > > > + mm = damon_get_mm(t); > > > + if (!mm) > > > + return -EINVAL; > > > + > > > + mmap_read_lock(mm); > > > + rc = __damon_va_three_regions(mm->mmap, regions); > > > + mmap_read_unlock(mm); > > > > This is being called for each target every second by default. Seems > > too aggressive. Applications don't change their address space every > > second. I would recommend to default ctx->primitive_update_interval to > > a higher default value. > > Good point. If there are many targets and each target has a huge number of > VMAs, the overhead could be high. Nevertheless, I couldn't find the overhead > in my test setup. Also, it seems someone are already started exploring DAMON > patchset with the default value. and usages from others. Silently changing the > default value could distract such people. So, if you think it's ok, I'd like > to change the default value only after someone finds the overhead from their > usages and asks a change. > > If you disagree or you found the overhead from your usage, please feel free to > let me know. > mmap lock is a source contention in the real world workloads. We do observe in our fleet and many others (like Facebook) do complain on this issue. This is the whole motivation behind SFP, maple tree and many other mmap lock scalability work. I would be really careful to add another source of contention on mmap lock. Yes, the user can change this interval themselves but we should not burden them with this internal knowledge like "oh if you observe high mmap contention you may want to increase this specific interval". We should set a good default value to avoid such situations (most of the time).