Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp1352433lqt; Fri, 7 Jun 2024 16:18:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX7igZ/lNHS+5GYoM1ZQ5aEUlyw0hcKWm5yKOCtZNMugHJIccTg3Kffg2qdeV1FdezQvR2/3YxyUZK1pjvHbeVx4S9gZrzxX/5s90SS2g== X-Google-Smtp-Source: AGHT+IHDnPxG4Z98cgl/19kQF/259WL61fEYvSXOjN9+sV1f7iPBmqHmJLKBmRyCR0E72dDlvzVA X-Received: by 2002:a17:902:e5cf:b0:1f6:7f05:8c0e with SMTP id d9443c01a7336-1f6d02c0674mr46113925ad.2.1717802284684; Fri, 07 Jun 2024 16:18:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717802284; cv=pass; d=google.com; s=arc-20160816; b=fgVQd3ha/AKqQTWLkqoncEsIKZRq3vij3mv1vBCLIvY/8LQ29LA889EJo+xNviugvz hDK7r6V57B9zNjPHJX78XAGra6Y5BNyWrv9zWHG/spi4mjXK1aYn+InZtjJJbc3O0TG1 z5jqOndykh1Tzbn9Q/l0en8Rf112OJT33YV5fWUw9I5Vy0LdUdo/Y8VN6SgSFkICZ3G2 DJmxccrg5fIc+p+SUAVgO8wodJrpMgxLs32+UdUW7Q0WEYhJ1JxR3XWr6/BElBG17UZw aCYOyNuRX7YHMZb0JsfNRXW5eoLFFQlDB+fkgkW0N5FTFzCpQ2hZE+hmb5L1x4jjA5i4 q5CQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=MAOu3r5TjNnaMsR0npAw2WjHsVUBpHA2CVLbSqT4c+8=; fh=g58VbHsjq7Pwt1joyWD5iId/gxSTumoqeqdAROUb5+g=; b=VnzByrEsNBZHd4hLjJLhIlUo2r9MyL+Oo6YvoFlDShqZ9X046hXOzNb9pUDPv0T9F2 WfEADeykW93NFJtH3TXDo3/c8LhZj1SNhhKTpX5q3BfOczslmpX8ArpwaLzr/1fUMJ4i H+jO6IgToir/3n/GCAdJW2u2KhLSO+iWNbSz/Mzi6KNno+p6UAS+gAt7OibdGEmJUNOk Gg6sNMG16YTJEj3aXXGbhEH4vVCdjL4N6IMRp08+eKQj4pVtI5e/YWdqZdtFWPMyga9E HIrsEHxfPaTuGX8yV8f/6M6/GI9CJuW1JmYmGSva5WPgMwVh/pLEanDhXpX3Oa38d3oO z3Mw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ULru72rS; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-206832-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206832-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f6bd7e561bsi9828335ad.391.2024.06.07.16.18.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 16:18:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-206832-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=@google.com header.s=20230601 header.b=ULru72rS; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-206832-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206832-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 C2AEAB23D50 for ; Fri, 7 Jun 2024 23:17:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F6C1136E18; Fri, 7 Jun 2024 23:17:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ULru72rS" Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (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 1222438DE8 for ; Fri, 7 Jun 2024 23:17:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717802271; cv=none; b=Vttnv+d7zLAAkxJaHUFOWrAAI/WxASkWtr7avup+8oDbQ+LJ8HUtA3AGCgW1Hd8AAcp55pIlTdNd8BLggmSEFBCSoxIxZPWP091IKBN4ZuibWUfij9m2L/ZhScGkOVWAhMZdEGiXMVJ0lWL/h3FB9IsckXuVgInM7QVRLE6eISs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717802271; c=relaxed/simple; bh=MAOu3r5TjNnaMsR0npAw2WjHsVUBpHA2CVLbSqT4c+8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=rcbTA8CAuHnezQhoy8Q7HcFeyFYUMPTcLs3VX7d/9aqW4b2Ru2NvS7luekq2sVR+a3SH13Yblp3g1X+Ja95eJgT2n/0/Njfq1liSXWc1wc+KZhqdTq1+K2ldPNObZ4kvcmOYh8MFHTNXvQeLyN/lkaRr7sBCDRyVBDEUJ/bqOxo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ULru72rS; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-52b93370ad0so3633932e87.2 for ; Fri, 07 Jun 2024 16:17:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717802268; x=1718407068; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=MAOu3r5TjNnaMsR0npAw2WjHsVUBpHA2CVLbSqT4c+8=; b=ULru72rSuj7M4wpZnsT34Bnjh4GJ+JZ62BhUU1MGVKkLNLZiXRE1bfH84SYGuUJr/q 7sMgJJ+EDLxL/IsSJyivmPBG6VrBuHP7mLnnEUJLIOALfKxKefYl7cXtTJzSxztlVqFV TYtPviOqqNpHKmHJYZcxlwMEwVfqU/x1k/3ezk5qAi8CnRurqWnvDQBrcdvfXMcXfT/6 n9j1D6UocAENXNEt0KhWUd/AIeyzozygJrhmZMhhBL7UGdiqjeiQ5u9g+K1wcmpZMMHd 8XS+AKz/Ouj2pERI0R43lTeh88RTxezQDDk//rn6wmlXzYjmIgUItu8p306zQUl39rR+ Dyqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717802268; x=1718407068; 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=MAOu3r5TjNnaMsR0npAw2WjHsVUBpHA2CVLbSqT4c+8=; b=iKDKxsy/J1jlca79E1NWqlAGrDb9TIZrwGgjgyBUNNPNp/l9Sex8YoIdeqHPb7hkYD sz52aMXuSuPIRXq1tZZE0EbOocg3+JOLU5S/2SBgE4E5cRXO9KyQgjHlz0NC8HhQsh7G PDEoBkJEHZg/P6pb01XZkEIIjz1lYCxQMJJlY907EcES3oQGGWGG3L64dc8xq+0GnD27 rEIo0fgzZitLJ7U6Ukge/J5/DO39vXgSPwVOd78lrJA8jIUYMAYwCKkaJXGNGedpQTGi sJbSYLEZRJHoRFRQT10iImxN40cp2CYxA96xaxwHu1exe/Dvd/+auVodhnMXFbDcGM6x 90Lg== X-Forwarded-Encrypted: i=1; AJvYcCVwxx8k8Q4C5BxYY/ELUheQ/P/MwZ9FjUEf/FM8wdtyTLH6bfLIOkU+mojag8g7I7xJTQ33cgNSmBqS9tj+eedslAQQsI63wOxziWYl X-Gm-Message-State: AOJu0YxVFaqHxymUJ1TiWm3jQbUN8JQEzAP5ZFMxroDkHmcB/x+IbBCC tMl1YxMuboEe3Y6CY5sr4zR3uRuQ8v32as4tYxcxIH5WsCkiXLHSxTcas4qiIriV7ExITJORAah Ec2wBtmP8sL3gGlkynt20/gKicmop5chSOwny X-Received: by 2002:a05:6512:201b:b0:52b:c88e:cec1 with SMTP id 2adb3069b0e04-52bc88ed2d5mr1115634e87.33.1717802268046; Fri, 07 Jun 2024 16:17:48 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240606184818.1566920-1-yosryahmed@google.com> <84d78362-e75c-40c8-b6c2-56d5d5292aa7@redhat.com> <7507d075-9f4d-4a9b-836c-1fbb2fbd2257@redhat.com> <9374758d-9f81-4e4f-8405-1f972234173e@redhat.com> In-Reply-To: From: Yosry Ahmed Date: Fri, 7 Jun 2024 16:17:11 -0700 Message-ID: Subject: Re: [PATCH] mm: zswap: add VM_BUG_ON() if large folio swapin is attempted To: Barry Song <21cnbao@gmail.com> Cc: David Hildenbrand , Andrew Morton , Johannes Weiner , Nhat Pham , Chengming Zhou , Baolin Wang , Chris Li , Ryan Roberts , Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" [..] > > One problem is that even if zswap was never enabled, the warning will > > be emitted just if CONFIG_ZSWAP is on. Perhaps we need a variable or > > static key if zswap was "ever" enabled. > > > > Barry, I suspect your is_zswap_enabled() check is deficient for > > similar reasons, zswap could have been enabled before then became > > disabled. > > I don't understand this. if zswap was enabled before but is disabled when > I am loading data, will I get corrupted data before zswap was once enabled? > If not, it seems nothing important. If zswap was enabled and then disabled, some pages may still be in zswap. We do not load the pages from zswap when it is disabled, we just stop storing new pages. So if you just rely in checking whether zswap is enabled at swapin time to decide whether to use large folios, you may end up with a situation where zswap is disabled, yet parts of the large folio you are trying to swapin (or all of it) is in zswap. This is why I think we'll need to track whether zswap was ever enabled instead (or if a page was ever stored). > > Thanks > Barry