Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp601926ybz; Wed, 15 Apr 2020 14:56:58 -0700 (PDT) X-Google-Smtp-Source: APiQypI2giVP57IYZsSdaRUZCqxY4rwE+rzOc4SUbkhUhGvx9CvQ3/rbPm1gin9YrV2MLEyiYvDG X-Received: by 2002:a05:6402:1a35:: with SMTP id be21mr20762610edb.354.1586987818029; Wed, 15 Apr 2020 14:56:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586987818; cv=none; d=google.com; s=arc-20160816; b=ZlraGUWBD6tveuDpYTf/Q+VZGXbYE79eYlPlV8U465WN1hy0ym81sNqIUk1MPq0UGY ANAgdDb/NuPzwXaM7F55DwI6yVi/NyXxcJSezvB2S2aryw13HW6jo0+zWKqo34CM4/UE fdA20mo35dKVj/zz9Vuozij8E/QplRbIuQFw6UsXbXO+u/jxu/QHZ+o0eoRl3cVp7LID sCNiSQ/2CUa/Io2IIyYik+Qeq05pjaulvUQtoONjzfTcMVIM01hKeZRNC1SR3OPmDyYW dnWmYbtgcS1gq0dY3zzJp2gO+EYZrsqGnUrNYSLbeElXjdcuoiBK+HZcaF07YtsOFLwI rvOA== 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=jj2SfzpXG2vA6JlDKL4eiWHkk7cpfBu8IVq5OsaqiRc=; b=Zo/Wjo7H42OkmFKVKWXtkj96uRSyKHmhwc/2BmPnR9viX9fJBqf5AyicUGFybJ8xj9 nHOhxlqU17z4vlyWSTj+AGD7g/sH+lGu2u6zUA5uHSufhIQbcS4T129EAu8M3BbrAsPE SfSEUmq560q1tO1QCOsbyU//rxGcpNvbdkEa6h+KDpWbxFIC9Ha2Nkx3yvyx2o3ctwaT VrqRYrWAfFHjz3GamQBqC0Av9lchb9ehSY6DD2MQjodmBp2wGTrxcG+y9ahoqPH90Yvj Lsx7+YV42TZOnX0JywF3GxrUGuJF7Fejf0fupJwIo3eu3n23SE4zWSgsXwtcxjICJ/DB eXrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=hRvZ3q3j; 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 hh3si10492455ejb.177.2020.04.15.14.56.35; Wed, 15 Apr 2020 14:56:58 -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=hRvZ3q3j; 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 S2633965AbgDNVfd (ORCPT + 99 others); Tue, 14 Apr 2020 17:35:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1731763AbgDNVfa (ORCPT ); Tue, 14 Apr 2020 17:35:30 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33C33C061A0C for ; Tue, 14 Apr 2020 14:35:30 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id q22so1494045ljg.0 for ; Tue, 14 Apr 2020 14:35:30 -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=jj2SfzpXG2vA6JlDKL4eiWHkk7cpfBu8IVq5OsaqiRc=; b=hRvZ3q3jq55HSrnCkkzeAGXrTsL41FHYn1NHzaoFXqmZ2lbV/tDRtYA+szFTAYL++r +x40YLtlUaHAd0iY4V7aUVJBSpUjdhHbK+Ld9VHczwxKML3hUcGWw0ke84L2CkBFo000 gjhpcvbO/YAYp6A++dcyJNSPMVxBKIwqXTmDUVQgVKJ2CaIXgOWoboB525DBWT77p6l4 NkaQk9XmEvimNONPKimGJtViDpiChtH18vH/T084/VMRr3ARuNqGl8ay1zi8SPoFTqBQ I0g5HXhNV0/ysU2bhAtPYjL/p/hTk01RxBXAeBWVWh7whYa4ydVyzwlInaoAz4kMLG9k YJDA== 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=jj2SfzpXG2vA6JlDKL4eiWHkk7cpfBu8IVq5OsaqiRc=; b=rtilguCrjV+x4DgQo6JBh2ABxjsbFuxg0fboB8YLJ6D0aQ4YbHflYe9mwzoCVMQW/I THiygfLN3p0GqWo4Zkdbg7ffIMCvdbv2kCGmtMBKy5nEVEjO1uNQXd+SjHLnxOqshqZs n8Dpzr36HzjNRhTumDPMqMK1TCFvvrk0RxFmOm9mcc0+jaL38ZKOOF38g9hx2Nd/ZLBt czaek7ZqVdGFANYYpMwaxMpNgR/UIrKlGcaTHbr97QgB+DDiWak8CuILA7asRBprvmf1 rq7qv/9gs+rqAXF0nIHbcaepjxDfzEjPoIH2asspn6a77s0vC2pvIgJa62RDdCuwOEuI 33Cw== X-Gm-Message-State: AGi0PuajhKon78Wr7GqEW7wRu/xcJsmmkwqudwQcj2NRhsYvusejYem4 Y27LyOyJK8I4yQGNLt1LFJ/wcw== X-Received: by 2002:a2e:a310:: with SMTP id l16mr1283122lje.255.1586900128696; Tue, 14 Apr 2020 14:35:28 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id x17sm9863062ljc.33.2020.04.14.14.35.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 14:35:27 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id B619D1029A3; Wed, 15 Apr 2020 00:35:26 +0300 (+03) Date: Wed, 15 Apr 2020 00:35:26 +0300 From: "Kirill A. Shutemov" To: John Hubbard Cc: "Kirill A. Shutemov" , akpm@linux-foundation.org, Andrea Arcangeli , Zi Yan , Yang Shi , Ralph Campbell , William Kucharski , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv3, RESEND 5/8] khugepaged: Allow to collapse a page shared across fork Message-ID: <20200414213526.ecn3zcgnqxoveddq@box> References: <20200413125220.663-1-kirill.shutemov@linux.intel.com> <20200413125220.663-6-kirill.shutemov@linux.intel.com> <0efcc512-6f12-1ff0-9885-871172fac766@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0efcc512-6f12-1ff0-9885-871172fac766@nvidia.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 13, 2020 at 01:48:22PM -0700, John Hubbard wrote: [Thanks for all your suggestions and corrections] > > + if (IS_ENABLED(CONFIG_DEBUG_VM) && expected_refcount > refcount) { > > + pr_err("expected_refcount: %d, refcount: %d\n", > > + expected_refcount, refcount); > > + dump_page(page, "Unexpected refcount"); > > > I see two issues with the pr_err() and the dump_page() call: > > 1. You probably want to rate limit this, otherwise you'll have a big > problem if lots of pages are pinned! Nope. Only if kernel is buggy. See below. > 2. Actually, I don't think you'd want to print anything at all here, even with > rate limiting, because doing so presumes that "unexpected" means "wrong". And I > think this patch doesn't expect to have GUP pins (or pin_user_pages() pins, ha), > but that doesn't mean that they're wrong to have. See condition. We only do it if refcount is *below* expected refcount. It should never happen. Pinned page would have refcount above expected. -- Kirill A. Shutemov