From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 522D9C433FE for ; Wed, 19 Oct 2022 05:12:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9C95D6B0072; Wed, 19 Oct 2022 01:12:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 979B86B0073; Wed, 19 Oct 2022 01:12:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 868176B0074; Wed, 19 Oct 2022 01:12:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 784326B0072 for ; Wed, 19 Oct 2022 01:12:56 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 4D1E3A01C8 for ; Wed, 19 Oct 2022 05:12:56 +0000 (UTC) X-FDA: 80036529552.23.49C48B2 Received: from mail-vk1-f178.google.com (mail-vk1-f178.google.com [209.85.221.178]) by imf21.hostedemail.com (Postfix) with ESMTP id DE1DE1C002A for ; Wed, 19 Oct 2022 05:12:55 +0000 (UTC) Received: by mail-vk1-f178.google.com with SMTP id o28so7850502vkn.11 for ; Tue, 18 Oct 2022 22:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Tsn3OyHoRZX6JOlMPNTDx4whUiEN4kCPVhBTFvwHPu8=; b=SZj/qG6d12NeiQ39Z0StB+piGZ6n9UDhmuurkSNGKvtNSptfIY4f9ZdrzlXTUjp/Zy oyj0mVvcCoswRfq/EAEXG8JdA0rCkcfHQp7CoMffYhYY+ood51ywdf3FPRjttqUrfPyR F8j4x83rwJXuOCLePbfkdzCgj775lXsWc14Gijytrgxx85bamPab+puNMyZIx/e6EMpi J1isSnCdhf6+rcgET/wg/+jPDIpe0lnsQxASRxznPH4JEP3yzpIZHH79CtIjzOcfUiQM bBHcYhuQsb1tAJo2q11Y5nEG/IK4z7xoIb5x3OF0i8SJP5FQVRnrTOuO3JMCVOd7umM8 Yb9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Tsn3OyHoRZX6JOlMPNTDx4whUiEN4kCPVhBTFvwHPu8=; b=vBbaGPvVlWAdbZq/sF8NPxGMPP73a06dDb5vzrosSmo8Dn1LXWm4rqCtY4sXoLF0IP EC4SvWZ9RnB2gEPORfikZ/l0LYlZk27YXt2ORvx+TKD6VElxWe6j1x0XPevswt+IfWS2 PD24HO5XEmQUzKILJgH6B6b6v7irzEX+xxVl16ieOkGHPOUtzpj9EMHWftlJg7lwqBxK 9XH2AHCrEn577Kz6jzYo7tbuKeAbzwXqSchAnEAdXOnNqEUBO/+mj0R/pk8sJHlFVFTZ 63CdDJVuvliPpgtQsoEcpfZ7OOpXNSgiYk56MVXxOQgbNf7x0l/2duBWIgoYmQoxx6s4 RpPw== X-Gm-Message-State: ACrzQf1Sl3EmcJEgmpGdXtoIIsap2DpXq5VeayBzAAxnjFdXjB6VH4Vm glbMSuYs9UBtDCb3G0bF5DP5nFEuY3zFeKXRdbd/8g== X-Google-Smtp-Source: AMsMyM6SktSiJkugkZcbX5dTE0MiPZ4xNqCw5b2xfuOMOkuJif+2DxVAbfz8sD7eD7/CXBV+bJY7RdflHDZtDkWqykg= X-Received: by 2002:a1f:2dc2:0:b0:3af:5649:c2b3 with SMTP id t185-20020a1f2dc2000000b003af5649c2b3mr2919208vkt.32.1666156374831; Tue, 18 Oct 2022 22:12:54 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Yu Zhao Date: Tue, 18 Oct 2022 23:12:18 -0600 Message-ID: Subject: Re: [PATCH v4 2/3] mm: changes to split_huge_page() to free zero filled tail pages To: alexlzhu@fb.com Cc: linux-mm@kvack.org, kernel-team@fb.com, willy@infradead.org, riel@surriel.com, hannes@cmpxchg.org, Ning Zhang Content-Type: text/plain; charset="UTF-8" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666156375; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Tsn3OyHoRZX6JOlMPNTDx4whUiEN4kCPVhBTFvwHPu8=; b=PnA78fiNm15YfiVE5ggLvHMZ1dNXaJZGdEK+2pbwVj7O8M5oGUrcDW/Eru5kf5k2ePzikH Z0552rokBG9Gv8IcPFXXCBA5QzKuXorGFDPSLiSLZwODkSVNvy6KsnHEcZM5U09Pg0sFe3 fIaAC1m7jIBrdpOkasnCcAQOUGlfPAk= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b="SZj/qG6d"; spf=pass (imf21.hostedemail.com: domain of yuzhao@google.com designates 209.85.221.178 as permitted sender) smtp.mailfrom=yuzhao@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666156375; a=rsa-sha256; cv=none; b=OFhQ+pfDacQ4M1AVb7Z1SvyI+2x24TzUZuzOtWpoSa4RhdDmLqjN5WM+hklsoKXBERRlOM P43C2TLGVkihWYhkgHFp70t8b0fT/zOq8ivCJ5ewgRBxblMbSdQYgPh7l+sbsXckpGKxlR kOZBzpMdNnRS87bE6vVbIDSoj432WLg= X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: DE1DE1C002A X-Rspam-User: Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b="SZj/qG6d"; spf=pass (imf21.hostedemail.com: domain of yuzhao@google.com designates 209.85.221.178 as permitted sender) smtp.mailfrom=yuzhao@google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: by3kwbf49635ge75j8cget6k6cimpeia X-HE-Tag: 1666156375-305194 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Oct 18, 2022 at 9:42 PM wrote: > > From: Alexander Zhu > > Currently, when /sys/kernel/mm/transparent_hugepage/enabled=always is set > there are a large number of transparent hugepages that are almost entirely > zero filled. This is mentioned in a number of previous patchsets > including: > https://lore.kernel.org/all/20210731063938.1391602-1-yuzhao@google.com/ > https://lore.kernel.org/all/ > 1635422215-99394-1-git-send-email-ningzhang@linux.alibaba.com/ > > Currently, split_huge_page() does not have a way to identify zero filled > pages within the THP. Thus these zero pages get remapped and continue to > create memory waste. In this patch, we identify and free tail pages that > are zero filled in split_huge_page(). In this way, we avoid mapping these > pages back into page table entries and can free up unused memory within > THPs. This is based off the previously mentioned patchset by Yu Zhao. Hi Alex, Generally the process [1] to follow is that you keep my patches separate from yours, rather than squash them into one, e.g., [2]. [1] https://www.kernel.org/doc/html/latest/process/submitting-patches.html [2] https://lore.kernel.org/linux-mm/cover.1665568707.git.christophe.leroy@csgroup.eu/ Also it's a courtesy to cc Ning, since his approach is (very) similar to yours. Naturally he would wonder if you are reinventing the wheel, so you'd have to address it in your cover letter. > However, we chose to free anonymous zero tail pages whenever they are > encountered instead of only on reclaim or migration. What are cases that are not on reclaim or migration? As I've explained off the mailing list, it's likely a bug if you really have one. And I don't think you do. I'm currently under the impression that you have a slab shrinker, and slab shrinkers are on the reclaim path. Thanks.