Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1423123ybz; Thu, 16 Apr 2020 08:54:36 -0700 (PDT) X-Google-Smtp-Source: APiQypIEcPCC33RqchflRoeYl2vzbg8f7yl7fMNNQY4z2W+KrunqGmnygc407ofrPVRDzmWPYvi7 X-Received: by 2002:a05:6402:1243:: with SMTP id l3mr28597786edw.280.1587052475890; Thu, 16 Apr 2020 08:54:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587052475; cv=none; d=google.com; s=arc-20160816; b=B8JVNyDr7GuZFl9IRN8sRQzciSQzUYmvwyXntzys6attHDIaEBiidtFG/wPpAroVA9 QokT4F8H714CTag1XZrVbQN7YE0HQAEH+0vE+o1Y5jU1Qyy0Pr9MgXqHl3HK2xskirTg WH5CUrWAofIEfm39LGCUzuH0ROV1C1SeR/uGcmA943KA2JqKJI0n7mfLOh9umPYa+bZ4 YNxbjJ1iAV1ZpHxaE2f4J4LJ0JCd7y+Or/ggHLl8xmZxt+Xm7IyV3Q2zEF+HtwML9gN6 svsTPoUCobfDs/HnSD+dqwD+/+UKSaZho243LUI3N9trFwOEvPMZWvGdVkbLxOuH/P7O /QJg== 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=FfAE3K8uyhxoa402bGrMeSvXqOseWRk+R6RkoAmXNwQ=; b=eJgigJSpQzlP9ii2tvsF8BddDcK//LwpNtJIfTItYnk3p7C4nwahPAhGrUMPfN6Spb Hy6rZsOosNywG/CAiuk2cHOnQq2ELT3q2guCcNmSict63rsizTZEyacofGGexZN2+ETL 6BkwCPjT82IxPEabYhnRO4xrzSDY8kmDRFbo5P/6EXUwmeyYR22NrXq/6DWjC0bzm6/I L1wsjjU2PmizlUoa3aevkP8lolRJLPXNWUF7YgE+rugZN1wHcUFQ0LIt7LeXff13j75B luIODcKWt9G7IMIm0F+1es7GFE62FF4GEKzcuzss7P9UmE5YN9+5x2CNhv6zJ3C2P8Jp 5CzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=bcbScya9; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u16si5563421edd.86.2020.04.16.08.54.12; Thu, 16 Apr 2020 08:54:35 -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=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=bcbScya9; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405589AbgDPPwN (ORCPT + 99 others); Thu, 16 Apr 2020 11:52:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2387689AbgDPPwK (ORCPT ); Thu, 16 Apr 2020 11:52:10 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9970AC061A0C for ; Thu, 16 Apr 2020 08:52:09 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id m19so5918104lfq.13 for ; Thu, 16 Apr 2020 08:52:09 -0700 (PDT) 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; bh=FfAE3K8uyhxoa402bGrMeSvXqOseWRk+R6RkoAmXNwQ=; b=bcbScya9mobQkne7CdnBOoVV0Pajye6caK4t9DX8OVKbpk4KPaho2o6R7qNTWu5hnS pnX3o2qdBH68qltybzBhi3TbamMqIgkeQ5uVLW/l+hzuqqCtAYuUiJ7hUJyF3fKI7Vvl UxZBC24nupXXkjC5dj6Wxo4LhFM+Dnwu3vdLc/ZcAac2M9dNVfNoNra8OD5jYJjHJ75m oEcYZ3ZVRC1k/pC4TWuqO3PMHvCmaf5O1YZKzraCCc6lletIanyHf+q7M41QIaxksWlX qAZfNCcK3TUwerJja/lIYutfXFqR80lcGYOsiXSp5aTtmCyhuAiZ9MluAoLWqb4AfwNy Z1Ng== 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=FfAE3K8uyhxoa402bGrMeSvXqOseWRk+R6RkoAmXNwQ=; b=E3/KOMPDjSw7NXTDRwcoeuA60Sn5jqrCFp2bO55MfUhX7UwyhPNc26wqcpd6SgsSnQ DCafx7NaTUrSCfToCNh7egZc5xoKG0wfeCurt0IYaSQRqTWtsRKKAHT6XyR6V72np0Sp dFzQo+Xi9pwBU7d+cf1s+DkNQrqfjJhjP6CXakKIod9jonH0jHv1vWkzEYavR3XxFTM6 AvKhbjMi40kFnsgtWUX5zMdtvCyQ8OYAdUut10cG83ymnbADdW2Yc09BB/QLUljlQkGr mo2/J+3pI1h2G6Bj5xXR+F8VzorIAqisGIwQA4apkeTJpCkByPxGvwjiRUTNuIoLUIb7 TXqg== X-Gm-Message-State: AGi0PuZEhG5F7KIf68agv9k+UrmlAvONBzsNG96Wqe15MAJptWEI8SK/ tn3DdqbWz++1z3o85Ibzc4bWKA== X-Received: by 2002:ac2:5e86:: with SMTP id b6mr6319687lfq.65.1587052328016; Thu, 16 Apr 2020 08:52:08 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id w16sm15683130lfk.49.2020.04.16.08.52.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2020 08:52:07 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 0F317102E22; Thu, 16 Apr 2020 18:52:06 +0300 (+03) Date: Thu, 16 Apr 2020 18:52:06 +0300 From: "Kirill A. Shutemov" To: Yang Shi Cc: "Kirill A. Shutemov" , akpm@linux-foundation.org, Andrea Arcangeli , Zi Yan , Ralph Campbell , John Hubbard , William Kucharski , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv3, RESEND 8/8] khugepaged: Introduce 'max_ptes_shared' tunable Message-ID: <20200416155206.bqpd5p45oud4chg6@box> References: <20200413125220.663-1-kirill.shutemov@linux.intel.com> <20200413125220.663-9-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 15, 2020 at 02:25:30PM -0700, Yang Shi wrote: > > @@ -595,6 +626,12 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma, > > VM_BUG_ON_PAGE(!PageAnon(page), page); > > + if (page_mapcount(page) > 1 && > > + ++shared > khugepaged_max_ptes_shared) { > > + result = SCAN_EXCEED_SHARED_PTE; > > It may be better to extract the check into a helper? For example, bool > exceed_max_ptes_shared(struct page)? It might be reasonable as part of wider cleanup: the same has to be done to khugepaged_max_ptes_none and khugepaged_max_ptes_swap. Volunteers? :P -- Kirill A. Shutemov