From patchwork Wed Jul 15 20:44:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11666233 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98373618 for ; Wed, 15 Jul 2020 20:46:12 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 81F832065F for ; Wed, 15 Jul 2020 20:46:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 81F832065F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 69C6B21F927; Wed, 15 Jul 2020 13:45:52 -0700 (PDT) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 5806421F72E for ; Wed, 15 Jul 2020 13:45:28 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 96689499; Wed, 15 Jul 2020 16:45:20 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 951852B5; Wed, 15 Jul 2020 16:45:20 -0400 (EDT) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Wed, 15 Jul 2020 16:44:58 -0400 Message-Id: <1594845918-29027-18-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1594845918-29027-1-git-send-email-jsimmons@infradead.org> References: <1594845918-29027-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 17/37] lustre: osc: re-declare ops_from/to to shrink osc_page X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wang Shilong , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Wang Shilong @ops_from and @ops_to is within PAGE_SIZE, use PAGE_SHIFT bits to limit it is fine, on x86_64 platform, this patch will reduce another 8 bytes. Notice, previous @ops_to is exclusive which could be PAGE_SIZE, this patch change it to inclusive which means max value will be PAGE_SIZE - 1, and be careful to calculate its length. After this patch, cl_page size could reduce from 320 to 312 bytes, and we are able to allocate 13 objects using slab pool for 4K page. WC-bug-id: https://jira.whamcloud.com/browse/LU-13134 Lustre-commit: 9821754235e24 ("LU-13134 osc: re-declare ops_from/to to shrink osc_page") Signed-off-by: Wang Shilong Reviewed-on: https://review.whamcloud.com/37487 Reviewed-by: Andreas Dilger Reviewed-by: Neil Brown Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/include/lustre_osc.h | 8 ++++---- fs/lustre/osc/osc_cache.c | 5 +++-- fs/lustre/osc/osc_page.c | 21 +++++++++++---------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/fs/lustre/include/lustre_osc.h b/fs/lustre/include/lustre_osc.h index cd08f27..3956ab4 100644 --- a/fs/lustre/include/lustre_osc.h +++ b/fs/lustre/include/lustre_osc.h @@ -507,17 +507,17 @@ struct osc_page { * An offset within page from which next transfer starts. This is used * by cl_page_clip() to submit partial page transfers. */ - int ops_from; + unsigned int ops_from:PAGE_SHIFT, /* - * An offset within page at which next transfer ends. + * An offset within page at which next transfer ends(inclusive). * * \see osc_page::ops_from. */ - int ops_to; + ops_to:PAGE_SHIFT, /* * Boolean, true iff page is under transfer. Used for sanity checking. */ - unsigned ops_transfer_pinned:1, + ops_transfer_pinned:1, /* * in LRU? */ diff --git a/fs/lustre/osc/osc_cache.c b/fs/lustre/osc/osc_cache.c index f811dadb..fe03c0d 100644 --- a/fs/lustre/osc/osc_cache.c +++ b/fs/lustre/osc/osc_cache.c @@ -2395,7 +2395,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, oap->oap_cmd = cmd; oap->oap_page_off = ops->ops_from; - oap->oap_count = ops->ops_to - ops->ops_from; + oap->oap_count = ops->ops_to - ops->ops_from + 1; /* * No need to hold a lock here, * since this page is not in any list yet. @@ -2664,7 +2664,8 @@ int osc_queue_sync_pages(const struct lu_env *env, const struct cl_io *io, ++page_count; mppr <<= (page_count > mppr); - if (unlikely(opg->ops_from > 0 || opg->ops_to < PAGE_SIZE)) + if (unlikely(opg->ops_from > 0 || + opg->ops_to < PAGE_SIZE - 1)) can_merge = false; } diff --git a/fs/lustre/osc/osc_page.c b/fs/lustre/osc/osc_page.c index 2856f30..bb605af 100644 --- a/fs/lustre/osc/osc_page.c +++ b/fs/lustre/osc/osc_page.c @@ -211,7 +211,8 @@ static void osc_page_clip(const struct lu_env *env, struct osc_async_page *oap = &opg->ops_oap; opg->ops_from = from; - opg->ops_to = to; + /* argument @to is exclusive, but @ops_to is inclusive */ + opg->ops_to = to - 1; spin_lock(&oap->oap_lock); oap->oap_async_flags |= ASYNC_COUNT_STABLE; spin_unlock(&oap->oap_lock); @@ -246,28 +247,28 @@ static void osc_page_touch(const struct lu_env *env, }; int osc_page_init(const struct lu_env *env, struct cl_object *obj, - struct cl_page *page, pgoff_t index) + struct cl_page *cl_page, pgoff_t index) { struct osc_object *osc = cl2osc(obj); - struct osc_page *opg = cl_object_page_slice(obj, page); + struct osc_page *opg = cl_object_page_slice(obj, cl_page); struct osc_io *oio = osc_env_io(env); int result; opg->ops_from = 0; - opg->ops_to = PAGE_SIZE; + opg->ops_to = PAGE_SIZE - 1; INIT_LIST_HEAD(&opg->ops_lru); - result = osc_prep_async_page(osc, opg, page->cp_vmpage, + result = osc_prep_async_page(osc, opg, cl_page->cp_vmpage, cl_offset(obj, index)); if (result != 0) return result; opg->ops_srvlock = osc_io_srvlock(oio); - cl_page_slice_add(page, &opg->ops_cl, obj, &osc_page_ops); - page->cp_osc_index = index; + cl_page_slice_add(cl_page, &opg->ops_cl, obj, &osc_page_ops); + cl_page->cp_osc_index = index; - /* reserve an LRU space for this page */ - if (page->cp_type == CPT_CACHEABLE) { + /* reserve an LRU space for this cl_page */ + if (cl_page->cp_type == CPT_CACHEABLE) { result = osc_lru_alloc(env, osc_cli(osc), opg); if (result == 0) { result = radix_tree_preload(GFP_KERNEL); @@ -308,7 +309,7 @@ void osc_page_submit(const struct lu_env *env, struct osc_page *opg, oap->oap_cmd = crt == CRT_WRITE ? OBD_BRW_WRITE : OBD_BRW_READ; oap->oap_page_off = opg->ops_from; - oap->oap_count = opg->ops_to - opg->ops_from; + oap->oap_count = opg->ops_to - opg->ops_from + 1; oap->oap_brw_flags = OBD_BRW_SYNC | brw_flags; if (oio->oi_cap_sys_resource) {