From patchwork Fri May 26 07:55:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13256585 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 C9320C7EE32 for ; Fri, 26 May 2023 07:56:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 508D9900003; Fri, 26 May 2023 03:56:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2875B900005; Fri, 26 May 2023 03:56:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D5EBD900006; Fri, 26 May 2023 03:56:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 8DAE0900003 for ; Fri, 26 May 2023 03:56:08 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 5B9031A0CD1 for ; Fri, 26 May 2023 07:56:08 +0000 (UTC) X-FDA: 80831648016.04.B240F82 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf25.hostedemail.com (Postfix) with ESMTP id B9A6EA000B for ; Fri, 26 May 2023 07:56:06 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=E15C01rv; spf=none (imf25.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685087766; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1AhvaQEykxRfZlsh2c4Dug9Lp7odXzIMf8TvoDKNOGw=; b=FL9QTx+TIN+mBW/8mOmznq6qaay7uru1BTyZOt14BtrW4IivV8XmJ/BA4WlWmTH4vU6JmT fJ8t1iy8fcH44t5pk3sUKEO2PFpl/fOS6pwEaVRdl1iB9Gwb1khkbH9Gg5JeRqVmOunip2 i09wNKVhsAfcPceYfMRa5lrZ9QUcwzs= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=E15C01rv; spf=none (imf25.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685087766; a=rsa-sha256; cv=none; b=a54fBkPDd3y7TfQUg6szd3USNXpjWnGd9M+IRxkxvlgd8Fs9tFnJhoL+41bLUFMlgMR8Ro pkKnB0SUdNPUfE8cAtNtbEga0AT/CTzbCB54FzfTeF1V7qgrDa7N+F+wUvwqR4Gs+TDjQZ y9nQHcFCEXv28C2s3ql6D8QgrxACd4Q= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=1AhvaQEykxRfZlsh2c4Dug9Lp7odXzIMf8TvoDKNOGw=; b=E15C01rvh8qJUhFpengqZNed+/ epNw4ByYQ60Hpq6UA2LISl8vHwk8zLvgERrEfiFp3oNWfTARAPEe7kg6OrC9oLUNypcBwftohyOnf +kL6CMebLub5C8stfDZczdk0CnTJ2fgF/4xjbR58muAKAcLkhsx0UFbRGlIlzEGokmwyiQyPBh2wB bKTkZouYgrnXR+ek49+JL+J0BZFyfmAg080+gR8oRXI7sFUtk8hhGst/KBWs76xcaNZWzGmiur9Ci XJdyxvsilz8bhnSS0ZbAagO3yezv4DQzoPICC07AQImRF3Kid2X8VB9bGdRAtSfY4kFBchyEre3KY lgFf96ig==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1q2SIk-001WZy-03; Fri, 26 May 2023 07:55:54 +0000 From: Luis Chamberlain To: hughd@google.com, akpm@linux-foundation.org, willy@infradead.org, brauner@kernel.org, djwong@kernel.org Cc: p.raghav@samsung.com, da.gomez@samsung.com, rohan.puri@samsung.com, rpuri.linux@gmail.com, a.manzanares@samsung.com, dave@stgolabs.net, yosryahmed@google.com, keescook@chromium.org, hare@suse.de, kbusch@kernel.org, mcgrof@kernel.org, patches@lists.linux.dev, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC v2 7/8] shmem: add high order page support Date: Fri, 26 May 2023 00:55:51 -0700 Message-Id: <20230526075552.363524-8-mcgrof@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230526075552.363524-1-mcgrof@kernel.org> References: <20230526075552.363524-1-mcgrof@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: B9A6EA000B X-Rspam-User: X-Stat-Signature: uk5xg1suzgedsjg93pzprtbeutyqcacp X-Rspamd-Server: rspam01 X-HE-Tag: 1685087766-420248 X-HE-Meta: U2FsdGVkX18Ar4uM2vugijVeYMlj5LQ1dRLvaKyX9odNZJ+XrVx4k4pxfYrPJ/VmGbv62NPnqeANrta1WrUxnnK+GOytG6b/5XynRMe+2YMX7wEETS6cCjNoCFbccqQF5MOWaUOXKSgDDTdLgCxmhZ2x5WyI5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zhtkTUhDMZad/YJdGR3wjBqXwIdO0piLgAQZXZAICaLZh9PLAf/XixVHpK6mhFrdohrcy1wPY4GZjrKMyvs+pk18KyHL153pSipPRQVRwX5HoIovkIScRlATqO8RqBGjX+FDuxjwZX7OxD3E7L/vuYLwfjSbVrFGftstsmIqZJaBPM3p/sOyC/EK0U+f/da7sNy4cmf0VC3LHPRAeK39B5eudKPH9g== 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: To support high order block sizes we want to support a high order folios so to treat the larger block atomically. Add support for this for tmpfs mounts. Right now this produces no functional changes since we only allow one single block size, matching the PAGE_SIZE and so the order is always 0. Signed-off-by: Luis Chamberlain --- mm/shmem.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index d347a5ba49f1..080864949fe5 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1623,9 +1623,15 @@ static struct folio *shmem_alloc_folio(gfp_t gfp, { struct vm_area_struct pvma; struct folio *folio; + struct inode *inode = &info->vfs_inode; + struct super_block *i_sb = inode->i_sb; + int order = 0; + + if (!(i_sb->s_flags & SB_KERNMOUNT)) + order = i_sb->s_blocksize_bits - PAGE_SHIFT; shmem_pseudo_vma_init(&pvma, info, index); - folio = vma_alloc_folio(gfp, 0, &pvma, 0, false); + folio = vma_alloc_folio(gfp, order, &pvma, 0, false); shmem_pseudo_vma_destroy(&pvma); return folio;