Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp321912lqt; Thu, 6 Jun 2024 04:59:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWCFOpX+KwOAjiHqscMEF5z/M+Pk98nvt5eF1eyS8VLoOGmfSruvi/W/FnU8/rjn/FKiuDxju8MMMhV6p3O8Lin8blZKq0mK0Zmxv+b+w== X-Google-Smtp-Source: AGHT+IEBYoysiwTV4dHq+GBNyIZgH1Wr0F1M9sc8uV1dDUZT5dhsvl7P7zBdfRDRDXHW66RBPoUK X-Received: by 2002:a05:6830:1216:b0:6f7:c2a6:970d with SMTP id 46e09a7af769-6f9437d86f8mr5901933a34.34.1717675162495; Thu, 06 Jun 2024 04:59:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717675162; cv=pass; d=google.com; s=arc-20160816; b=zdli/sU2iqV4kDuH0mHoSEhWoKwAkqjO8U7J7+jgmBpSRpg8Dv9yTcZ3QomGRVo9XB Ke2q7v/smxm1rjlWiUDGqP4curdq2BlDKkazvNTVlJb6U6wp74JNvYaZi7kdr05ZLYVu evNbXxfD8kYF6t1EkH1WbNwk15ofaJEZ2f6qNgDdCXaEflvMy70mRe00bnKEAY/EZ9Ky I5Yewz1JUy8G0UH8N2q0yCxms5t6TMDM58ffVCx1Me5SL45dQbeMyU3HE5yDH4vtyY9x 9bp8aA4gQBrvEYG2AIxW7eyyXo2lEeU7KvBuSavcDCBPwPsK1f8JcJI8F8HAKc1qDTpT GMuw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=jM6eZe4x6k+egILzv89K9Z+MG/ZZ4Ym9gSqYkloSOdc=; fh=Ga7JTaoZDeof86+j9POZ6Xv2e481OdNpwFcgcgBxajo=; b=bM70284T/Klogi50vtAIW4LwvGuL6aF+crtjLyTU40FWvDYpe0e/dYfeA3bvUIozfd atcDXOzOKWciddYC5G2eRHrY1nhnULqOquP4Dou3Dei81PE1sjGdDokRpn4//92RX+GG PpyxI6y+6Ml21nKd5sHwLcUt5tiem1E9SJJjmCIykvuGBY1F0klQa656rgq8IyppCOqJ nadty9hkS9yKH++OOJho/jJtGagXLVQkBh7g10j/XPZ7Sda0tARYJI2nwfxv4bM1Cri0 h0aKm5q/bOCWtc8DvzxO5VWDruTeIxV0UtjSx70BzM18Yip78fmGpFfwxS3B3UMqXPiI IF+A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=caBHPkLo; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-204214-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204214-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-795332ed580si138915185a.453.2024.06.06.04.59.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 04:59:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204214-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=caBHPkLo; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-204214-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204214-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 38F861C23FE4 for ; Thu, 6 Jun 2024 11:59:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 870F7195971; Thu, 6 Jun 2024 11:59:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="caBHPkLo" Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 325444DA14 for ; Thu, 6 Jun 2024 11:59:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717675156; cv=none; b=XMhGGbQ64yH6d3JRWjE8pvrZfjWnIG9nAB+NCjPkccyKVRq5wOcRD4l4IuPzIh2CmWnlL4eHoI3J0tWOA2DEwIXEM7Aho8ucPei/PeePsx8XzB3RqqQxG3qQfmBX6NG6Ph95zaooF9uaJeHqtWNgkJbbkq4OWxEq7rAwC1TuP04= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717675156; c=relaxed/simple; bh=DafEl+bQ3wLqzbq8YRcPrHFmGq29QWdzWlhvrhemJRI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=SRdT5bHi4UJPgxdA3Kg3cpKp76hJZ537qexsZzudAKwk83mIyvP3pIGsez1RsiwpUDiIhnsj9B/4LQVbwVhvI4iWCEMOcYXEupYl55I4SoFyblqaISesCvtCKdTtp2nvKTkzI3RaVSAMiUqtGkufgE2lf4F4HtfF8nXk1FZqny4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=caBHPkLo; arc=none smtp.client-ip=115.124.30.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1717675152; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=jM6eZe4x6k+egILzv89K9Z+MG/ZZ4Ym9gSqYkloSOdc=; b=caBHPkLoL3jvQRFWoUk1n7jQa2VhnnEQ3W+UrXZ/KD30aG/PpOHfr+cKCRw1p3Q4OEmkC2hK+otsiYm29dbiAamhy/ID3UUHMdJh0eQeorCVN8f8Iqab4nrEn5NlcvWWYT0TzgY/mpGWTRRY3v0pSv55Mmnr0AiGD234jaD1FgI= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R551e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037067113;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---0W7y6tom_1717675149; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W7y6tom_1717675149) by smtp.aliyun-inc.com; Thu, 06 Jun 2024 19:59:10 +0800 From: Baolin Wang To: akpm@linux-foundation.org, hughd@google.com Cc: willy@infradead.org, david@redhat.com, wangkefeng.wang@huawei.com, chrisl@kernel.org, ying.huang@intel.com, 21cnbao@gmail.com, ryan.roberts@arm.com, shy828301@gmail.com, ziy@nvidia.com, ioworker0@gmail.com, da.gomez@samsung.com, p.raghav@samsung.com, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/7] support large folio swap-out and swap-in for shmem Date: Thu, 6 Jun 2024 19:58:50 +0800 Message-Id: X-Mailer: git-send-email 2.39.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Shmem will support large folio allocation [1] [2] to get a better performance, however, the memory reclaim still splits the precious large folios when trying to swap-out shmem, which may lead to the memory fragmentation issue and can not take advantage of the large folio for shmeme. Moreover, the swap code already supports for swapping out large folio without split, and large folio swap-in[3] series is queued into mm-unstable branch. Hence this patch set also supports the large folio swap-out and swap-in for shmem. [1] https://lore.kernel.org/all/cover.1717495894.git.baolin.wang@linux.alibaba.com/ [2] https://lore.kernel.org/all/20240515055719.32577-1-da.gomez@samsung.com/ [3] https://lore.kernel.org/all/20240508224040.190469-6-21cnbao@gmail.com/T/ Changes from RFC: - Rebased to the latest mm-unstable. - Drop the counter name fixing patch, which was queued into mm-hotfixes-stable branch. Baolin Wang (7): mm: vmscan: add validation before spliting shmem large folio mm: swap: extend swap_shmem_alloc() to support batch SWAP_MAP_SHMEM flag setting mm: shmem: support large folio allocation for shmem_replace_folio() mm: shmem: extend shmem_partial_swap_usage() to support large folio swap mm: add new 'orders' parameter for find_get_entries() and find_lock_entries() mm: shmem: use swap_free_nr() to free shmem swap entries mm: shmem: support large folio swap out drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 1 + include/linux/swap.h | 4 +- include/linux/writeback.h | 1 + mm/filemap.c | 27 ++++++- mm/internal.h | 4 +- mm/shmem.c | 58 ++++++++------ mm/swapfile.c | 98 ++++++++++++----------- mm/truncate.c | 8 +- mm/vmscan.c | 22 ++++- 9 files changed, 140 insertions(+), 83 deletions(-) -- 2.39.3