Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1117218ybh; Sat, 14 Mar 2020 18:31:00 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtbx0pxIa74uprwHmNjGsKRh1D15eadC2pW3suNnSLzqVdbmqhZXNJieH/Ksft4A69AUuky X-Received: by 2002:a9d:69c5:: with SMTP id v5mr11412239oto.228.1584235860357; Sat, 14 Mar 2020 18:31:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584235860; cv=none; d=google.com; s=arc-20160816; b=gvqHMlHruS6Mr/I/rtU71Fi9wGle708+suRKFOOIP79/IGDvvDArCHhgWhX6GwwmBA rep9+bh9fj9wS8tzK3c7AUiNMhvVw7uWG5oaxWJL+T/o/uM7Q7nY0cbomGhRF8T0r3rg 98CnbArh4BLPUL87UqteREewYRWd8uaTK2yfWAHD/DElfhJtailQAhQpYpwsygWn4o9g MTyD8VSBTMAiFZs0BAHpUgrvEN4V2h/x6SC4BoR7WUWMqHcLw0yM261ACkymY4DN6uaP qdgUPXEIgfhesNaeQpbhzxFwW9oSvcLuqBzb6An5jBWB6oTIHqufZCpyxV+Xrk/1Li+N fSsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=uRfG0mwZMLjMl4FPHbusrIQaUL5wynktLP8666hh0Ic=; b=rzGxnlk0S2pg2Z2gEsbm/KHpQ4+G91PpVbGNQUG+PoFkqJvc6FY0Xi04fnzOMyfUlc yIyOz8lyWtzdvVqekUVKsmXPIy/Xcfa9GzULLt2X6EIMCSbAw86bS9NK/c3Gz5FmZjz6 vZul+X28G44wK2+3IrM5YE+5U6MzpMAri2FwBrqY6uaJec/yEddqnw9iTLijnMVxtZKt LZ2Y8SRpDEu4HQ2UWiYStdemkOmrRKTQBleJLq7GGIxH3knQ0C7YLlU2iaTtlMO04/a1 b62YbTcOej0F591iD2mQ3OcOqvTa4a6XA/w3Ga6ecjME2SFlIY9fmzI2D8LHWGXRjgKW Dvuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=q3u295ya; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o9si7088620otp.222.2020.03.14.18.30.34; Sat, 14 Mar 2020 18:31:00 -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=@gmail.com header.s=20161025 header.b=q3u295ya; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726932AbgCOB3o (ORCPT + 99 others); Sat, 14 Mar 2020 21:29:44 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:54712 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726916AbgCOB3k (ORCPT ); Sat, 14 Mar 2020 21:29:40 -0400 Received: by mail-wm1-f65.google.com with SMTP id n8so13872053wmc.4 for ; Sat, 14 Mar 2020 18:29:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=uRfG0mwZMLjMl4FPHbusrIQaUL5wynktLP8666hh0Ic=; b=q3u295yaWvJtyF0nX+itH6MgcSpzhi/WW183Rq9wGLBRLMK9E1D9n+YozKtG8wr/cW prWRdLnb5KqNYxGwbMr9NT1YXCcGu+szlyiWm3eF1GxPkmszRZ18gO9IH9tgVp4xnEHl scK3h4clMAHm72HKMPZn1BizqC782jmNPtEXG1D4qfrS9CitoHmvo7uLkih+M323gton nO57LOy9ng7Dlbj9WkBQ3/La2796jyVvUbYmYQKdMUxXLySTdoqmzQ9A61v8r/5qr4zm NPI6P9Hm96BHEFikcg2n9El7/tXtLB0Fv20UfC/MYXkAjVYXE3ib9ukBOvtb0Hicd8lN ow8g== 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:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=uRfG0mwZMLjMl4FPHbusrIQaUL5wynktLP8666hh0Ic=; b=Vyj8atNhJcPA4tfhziISSaLLkKUZWgSJ32mjDh1yj6yjxINUiTLNnneXTu0pidvZga xea4F+XBieOOHwX/+Xk8HzGynNqwsgmzuwdKA/GWTxElXAiGw6YF7nHkDoGmPSDMPMz0 6sQ3qXwjlj54VU3dIKaqYriD5FNOJce99f+v1LWybase7j4S+3jJ1qICg8U/CpxXn4gk DFUdRa1HBsKastgXe5221VJt6QZ15t5Joe9xLsK9x7DpZnaBLwrVkSuJ4YXVbrA1XWKt pKdZQSZtmS0bfCvs4/qaFEvtzv4jh++Trfsk70dqQ74LT6I/IJFxVQ4qThjySRJ7oyOX igxg== X-Gm-Message-State: ANhLgQ29N9d7Hd7v9F9ZaVCkNA/FKgk2Tl7yckY+siAoBc6WRNoAAdEC P57roWhIS0ZSTT1eTsbgrFpNH3iy X-Received: by 2002:a1c:b4c1:: with SMTP id d184mr19096815wmf.160.1584235440708; Sat, 14 Mar 2020 18:24:00 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id h18sm22200107wmm.6.2020.03.14.18.23.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 14 Mar 2020 18:24:00 -0700 (PDT) Date: Sun, 15 Mar 2020 01:23:59 +0000 From: Wei Yang To: Matthew Wilcox Cc: Wei Yang , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/swap_state.c: use the same way to count page in [add_to|delete_from]_swap_cache Message-ID: <20200315012359.uebl54wauvcpd5j4@master> Reply-To: Wei Yang References: <20200314215912.1554-1-richard.weiyang@gmail.com> <20200315002101.GT22433@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200315002101.GT22433@bombadil.infradead.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 14, 2020 at 05:21:01PM -0700, Matthew Wilcox wrote: >On Sat, Mar 14, 2020 at 09:59:12PM +0000, Wei Yang wrote: >> Function add_to_swap_cache() and delete_from_swap_cache() are counter >> parts, while currently they use different way to count page. >> >> It doesn't break any thing because we only have two size for PageAnon, >> but this is confusing and not a good practice. >> >> This patch corrects it by both using compound_nr(). > >You're converting in the wrong direction. hpage_nr_pages() is optimised >away when CONFIG_TRANSPARENT_HUGEPAGE is undefined, whereas compound_nr() >is not. Ok, I didn't think about the optimisation. Will use hpage_nr_pages() in v2. > >I also have this patch pending: >http://git.infradead.org/users/willy/linux-dax.git/commitdiff/192b635b428ae74f680574cdcc3d5e9d213fcb64 -- Wei Yang Help you, Help me