Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp92892lqb; Tue, 4 Jun 2024 06:11:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUUBJLDKQwMNdtqfl0nMjdlNC6l8HeHzR1QTwf7XdO1nIlWI8AmLev98dfgHhqtwTCokuxGlfQTj5owYLDUn7aO8vwtITT8ojnu3AT7wg== X-Google-Smtp-Source: AGHT+IGRc0rs3a40ijQa77gcImcpnNVFwx6mkTzGdjJEL5rcXxIn5ppXZk53WMWG2RNaHyXxNjxi X-Received: by 2002:a05:6a20:8401:b0:1b1:d878:fc02 with SMTP id adf61e73a8af0-1b26f0f1b41mr14083657637.9.1717506679492; Tue, 04 Jun 2024 06:11:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717506679; cv=pass; d=google.com; s=arc-20160816; b=hqAUs6xJ3MDiu38zX9MEI/dsUaukmMChacgMnoHA60xf/SdCb7t+S16iCtOkw8gHqF /TEfCNjVCjXP1cIuLIW5wEDwdsuI4MAtezGllWTUToZ9ShXJEM5tKvLFAU+Miinnpovt 1Gc+O1UXcHtZrPlzDD2AYNcrePBFKD6Q3OfxnKi3DWzYTW0Yk57nF/7pg9/u1ApRNq7L qtfH6YkhSrfK/yt9K7PoFCkGzdbqW3g5ANLd+RYmd6RU2AnI5eD4BC7vosXepAVAygyg m+ov6XmJMubk0eJPpVtLj1v2kq+6DbVJRkNNZEqJ1iNhwKVehx5bZRz4gQePl1pVry3P 2+FQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=E/n7qDUO8vNDyhk1OfOnQdEu1R0VNUdXXI3i796MnfM=; fh=2yU4Vg6GZkMS2ScQny+iT4zxA0DMfNKQKSnCkd5MmBc=; b=tHqJcg4vB/vGfRXDHgdIDv+GfkmJzdNEHtp12a00kwueMAbSOC2GxT2cWeqjnfU40S SMBVgxJSVdDo+q8RJtzOQVaqMMzL8OCAd/yL8JlObRWPZVjgV3BBYSvK2HNqop3CBcnA qidNX0Eru3X2xOnRj6ptM9p/vlwZFWZS9NDyelg+NzD+7u40Zk7IqgK+TyKILcq3uyt1 To3imklf2TVoiTBpD1swEmzTmE1kjf/mzCRTHjbTquCliDXsrVxm2x2bk7ImbKl05rmf zcp/KTlPf+ndgBeZ/93DdttPkAkwsa7sOv6OnOEB4GncCuAxokGwNkB6pxRRHAcLadTv 4XTA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hcIwl54q; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-200620-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200620-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d2e1a72fcca58-70242d5a62fsi8271884b3a.367.2024.06.04.06.11.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 06:11:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200620-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hcIwl54q; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-200620-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200620-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 5F03FB230F6 for ; Tue, 4 Jun 2024 12:42:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 147E3146006; Tue, 4 Jun 2024 12:42:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hcIwl54q" Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5F003236 for ; Tue, 4 Jun 2024 12:42:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717504950; cv=none; b=NZJN/GRhN/2rVHhqR+Cc1GV/0srbz3e1O0zkH0AUV7KO1ZFsLbvllzKMkfC2ItfQhvRnXyO7VJzGetq09U+KcFGyMVHqmnNi++vSZ3ImCgywhWyQ/UJ3GZBx4JScojKsQ1JCic6rC9Jxu4iPMpZPQOFAgm8YrEYDBt100yBgtQ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717504950; c=relaxed/simple; bh=BMnlfEJlTS0IQ6FzNJfbrm417QDYt9wsDIxW3CbVFbI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=h6vvfNaNAtMaZVzCJhZ4g62DrR2EBbmyCqMjjzBTJ7lK9XbbxPrYvGnLNUOwJdUhFolH5D+K6iK8OZh5M2Kla4iCcjKylAhM4ZxseRlBjvt7SQq0X9ViWdKbxxVA6OgaCRW0NOJCbgNjEbqzGuwv9j/mZe/tcbIbPopvDlvwJBE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hcIwl54q; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-57a2ed9af7dso6037515a12.1 for ; Tue, 04 Jun 2024 05:42:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717504947; x=1718109747; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=E/n7qDUO8vNDyhk1OfOnQdEu1R0VNUdXXI3i796MnfM=; b=hcIwl54qMejb37KcacGTkApKY/Mhpz8Pp9IdTqAXbQ2WPvOIsFP3jP8GnAtyzxDHix Cy8Kwp0nCFeSNaTEscUK+kHvn/C5qF++E3KX/ujEuOJlj2Lky5XOUq1otC/NUuO706p+ fBQLa6emKS8nGT69EacCDgCEiMSuIYa30zdXE/PgDjNc2HqXIgW48PuMoTxTHNL+mJt7 pQRPG7bPcdK66dYGxCWmNQgOiRU6akl0m4+t19zcqg7rropTvuMH7B9P5Dnn8BZOlzK+ nVuHeQzCAvkHfzATlRHCPahb4VfY2H7xx2XfUeyt1luswiXBekWbcmGThx5PMoOLRuOt PCBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717504947; x=1718109747; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=E/n7qDUO8vNDyhk1OfOnQdEu1R0VNUdXXI3i796MnfM=; b=bgibbynm3TXuYIEzFNZZY/0xLu+gKcd9JudsN/S59QN+2HbcTkF0XBYKvSdtIrG1QZ usI9RVvQVOfXyZ8LvL2LGVz+V8gQ8BoCbwUfBwKIEIrKorz336pflNZ+ApXt+FT1xETf 99Iluw2p2EPQH8xDSF36FGF1vlvbefOG7XGvK5B2Jz+PuWIBQWuhT5YsmRBu6AZWSfpt lv7rgqI1II/xglk5pfBLIANW2UuT/P4Rvd3pPrKVMwYKDEvZn1ScH2mfHW+2AMiOHLIp hNf3zEmatgbsHwJzFZCVGHspUDkDL7qiynp9wIvvcRqaKYPv4RTMYU2+cNH0G5zbT6e2 vUgQ== X-Forwarded-Encrypted: i=1; AJvYcCWCBc8o00nXszFt65BZfdYSOTDTT31e1KqtX+PqlyVlbzzzpD78gA5VcHGap0qAgL0Kc0sCBc/EA/Ld6vynYPwXd2iUDPVfEx8shqJl X-Gm-Message-State: AOJu0Yy58OJWokyktH2y2wqXrYhg/5RqCiKlYDKZloF2D1BqkQ8c+KmO LTECGycXMHJJ4gCaypnaEPMD9flfDG92GzXgQb1JX+fbv6jkBWQD X-Received: by 2002:a17:906:ecb6:b0:a68:2d37:fb5a with SMTP id a640c23a62f3a-a682d37fd6amr799648866b.4.1717504946805; Tue, 04 Jun 2024 05:42:26 -0700 (PDT) Received: from ?IPV6:2a03:83e0:1126:4:eb:d0d0:c7fd:c82c? ([2620:10d:c092:500::5:89fc]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68f2d64203sm367906666b.212.2024.06.04.05.42.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Jun 2024 05:42:26 -0700 (PDT) Message-ID: <7253d276-1bbc-47a8-a5c3-c7c8ec43bab0@gmail.com> Date: Tue, 4 Jun 2024 13:42:25 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/2] mm: clear pte for folios that are zero filled To: Matthew Wilcox Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, yosryahmed@google.com, nphamcs@gmail.com, chengming.zhou@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com References: <20240604105950.1134192-1-usamaarif642@gmail.com> <20240604105950.1134192-2-usamaarif642@gmail.com> Content-Language: en-US From: Usama Arif In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 04/06/2024 13:18, Matthew Wilcox wrote: > On Tue, Jun 04, 2024 at 11:58:24AM +0100, Usama Arif wrote: >> +++ b/mm/rmap.c >> @@ -1819,96 +1819,101 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma, >> */ >> dec_mm_counter(mm, mm_counter(folio)); >> } else if (folio_test_anon(folio)) { >> - swp_entry_t entry = page_swap_entry(subpage); >> - pte_t swp_pte; >> - /* >> - * Store the swap location in the pte. >> - * See handle_pte_fault() ... >> - */ >> - if (unlikely(folio_test_swapbacked(folio) != >> - folio_test_swapcache(folio))) { >> + if (flags & TTU_ZERO_FOLIO) { >> + pte_clear(mm, address, pvmw.pte); >> + dec_mm_counter(mm, MM_ANONPAGES); >> + } else { > This is very hard to review. Is what you've done the same as: > > if (flags & TTU_ZERO_FOLIO) { > pte_clear(mm, address, pvmw.pte); > dec_mm_counter(mm, MM_ANONPAGES); > goto discard; > } > > ? I genuinely can't tell. > Yes, thats what I am doing, will switch to above in next revision, Thanks!