Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp252964pxj; Tue, 1 Jun 2021 21:06:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMuq4ZhDNo6SaeamkEb4RJF9yAVOjqqhCKS8XJre+lR2+PJLTYRzAfJWA8zYsBhCKQZzbo X-Received: by 2002:a6b:5c18:: with SMTP id z24mr22850155ioh.127.1622606817271; Tue, 01 Jun 2021 21:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622606817; cv=none; d=google.com; s=arc-20160816; b=I0OsVnm5kWPCfRAlsYssqYsooKoUjoXWTxjc5C8mlrhdu+2wjBvOfs2JntRzKZg8Bh f9WAHs4C24HQlaWqMaVnVuqX9chIkygLDLOTCy/yjAr0PS1+VBCq2AkPX7hq5ii4uFeM tJGqyTVdBmmdQaxFi36BOdEdgLpkm7VVoS5C75Fsw79Ml49SUtgXkWZGhRKX0Su5yR4j m6nIg4ZMByeyVyXTkSS0Fq0wmy9QgA2sWDDgOe+tNW2q4015Mf49KnKUwwNqDg9r1r8g LR0+4ib9KFhbJrM5la0CS9OaatOZBF00YvlnSKWNIXd/ypINxzXXxjaGN9oMrR0Uu8kU v9GA== 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=r/zWmzR0Uw8QrtnlcpwUmwYP/OScyryb/Sf1j0emqwg=; b=t1Rf39vqW0R6CxGaTSy2Y+FhsO743dum7SzdAW3o05dTzBKZqZ1zieHtVkV8krt4st uuT+XCxs2A43z07dZe8NG95R79maqYEpwIi8s5Nsl2CQ3lxCVdvMuScg6sMEbT8NzVi+ Grl4FCaE4zByFJBA7GhvgYhZ9VPSGqIW0X87wvWoL8bEI5D5ZvMANzllkHPYuo2hy6NX lFe0GMaTAtpqSB7NAloaITbExmTKPxippjvsl3dw3kr8lCOQdghOlfmFxPspS9jA+WcY KSTiUaX0unfz80USHR8hdy+S8KDKxN8gDn8of9AG6mXC/ukolJfnqV/h3QwjpvvCytQo ycQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=SsECy9lo; 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 v17si7133349ilg.30.2021.06.01.21.06.43; Tue, 01 Jun 2021 21:06:57 -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=@linux-foundation.org header.s=google header.b=SsECy9lo; 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 S229734AbhFBDU6 (ORCPT + 99 others); Tue, 1 Jun 2021 23:20:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229691AbhFBDUz (ORCPT ); Tue, 1 Jun 2021 23:20:55 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6A26C061574 for ; Tue, 1 Jun 2021 20:19:12 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id f11so1075027lfq.4 for ; Tue, 01 Jun 2021 20:19:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=r/zWmzR0Uw8QrtnlcpwUmwYP/OScyryb/Sf1j0emqwg=; b=SsECy9lobUU8r8wKfxNiZRL2vW9bwzGqVFMzpdTKmkOrs80r2ixuRUvKnSf39X8ZJ7 /bmQdGbqnckxAwQQpztZtvI6Byphk5K/ZkdikURvwRNL+Ix0bVk/KrUBDQFELRbPWZgO uIPRHzOJm2ARnkQVoO3gRPovpAaRqx2bC6eos= 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=r/zWmzR0Uw8QrtnlcpwUmwYP/OScyryb/Sf1j0emqwg=; b=NT7pmAbj0KLB2qPo3UnyabIBSfVOkan0giRnAIrgvY7hQt07yPP6le7aQT7fFr38To yHASd3qLqVceIQv8x/lvQnM1ISdhZq3R9cnNzVwwHHVnNsfokevHxbu8L6B8WTkQcvFD ChKUegRG57BGZzIs8IY1+yCmE7E6abW1+jZDxsDH88/OhlvKKTbtrw6zuM7E6s+jVFAK KNVVMukq9gTZTOvvjZdk60UIVFQCxkjQa2Uhp3ZMA9r6k6CaF/Wr9h/ulAx0Ars1cNwc EJGyrq8qT35eSaGmNUfNiIyUm49Ru+WDYhKpmatg9RLJ26WL1dNy79CUV2rQzIX12TyA XWRw== X-Gm-Message-State: AOAM531zhuwka9z/4he0HzVeB5FNhUYLN52h7PnC2lR17goL1IwPRUAg 35inDKBOWTpVEwo/EohfVPSwxqyx9LtnuWnvJEI= X-Received: by 2002:a05:6512:2249:: with SMTP id i9mr9853160lfu.592.1622603950825; Tue, 01 Jun 2021 20:19:10 -0700 (PDT) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com. [209.85.208.178]) by smtp.gmail.com with ESMTPSA id p21sm1849483lfg.97.2021.06.01.20.19.10 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Jun 2021 20:19:10 -0700 (PDT) Received: by mail-lj1-f178.google.com with SMTP id m3so682086lji.12 for ; Tue, 01 Jun 2021 20:19:10 -0700 (PDT) X-Received: by 2002:a2e:b60d:: with SMTP id r13mr1816032ljn.220.1622603949840; Tue, 01 Jun 2021 20:19:09 -0700 (PDT) MIME-Version: 1.0 References: <20210601053143.1380078-1-ying.huang@intel.com> In-Reply-To: From: Linus Torvalds Date: Tue, 1 Jun 2021 17:18:54 -1000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mm: free idle swap cache page after COW To: Johannes Weiner Cc: Matthew Wilcox , Huang Ying , Andrew Morton , Linux-MM , Linux Kernel Mailing List , Peter Xu , Hugh Dickins , Mel Gorman , Rik van Riel , Andrea Arcangeli , Michal Hocko , Dave Hansen , Tim Chen Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 1, 2021 at 5:00 AM Johannes Weiner wrote: > > It's free_page[s]_and_swap_cache() we should reconsider, IMO. > > free_swap_cache() makes for a clean API function that does one thing, > and does it right. free_page_and_swap_cache() combines two independent > operations, which has the habit of accumulating special case-handling > for some callers that is unncessary overhead for others (Abstraction > Inversion anti-pattern). Agreed. That "free_page_and_swap_cache()" function is odd. Much better written as free_swap_cache(); free_page(); because there's no real advantage to try to merge the two. It's not like the merged function can actually do any optimization based on the merging, it just does the above anyway - except it then has that extra odd huge_zero_page test that makes no sense what-so-ever. So if anything we should try to get rid of uses of that odd free_page_and_swap_cache() thing. But it's not exactly urgent. Linus Linus