Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Aug 2018 01:29:30 +0000 (UTC)
From:      Matt Macy <mmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r337672 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201808120129.w7C1TUAj098097@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mmacy
Date: Sun Aug 12 01:29:30 2018
New Revision: 337672
URL: https://svnweb.freebsd.org/changeset/base/337672

Log:
  MFV/ZoL: Fix stack noinline
  
  commit 60948de1ef976aabaa3630707bcc8b5867508507
  Author: Brian Behlendorf <behlendorf1@llnl.gov>
  Date:   Thu Aug 26 10:58:36 2010 -0700
  
      Fix stack noinline
  
      Certain function must never be automatically inlined by gcc because
      they are stack heavy or called recursively.  This patch flags all
      such functions I've found as 'noinline' to prevent gcc from making
      the optimization.
  
      Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c	Sun Aug 12 01:17:32 2018	(r337671)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c	Sun Aug 12 01:29:30 2018	(r337672)
@@ -3101,7 +3101,12 @@ dbuf_check_blkptr(dnode_t *dn, dmu_buf_impl_t *db)
 	}
 }
 
-static void
+/*
+ * dbuf_sync_indirect() is called recursively from dbuf_sync_list() so it
+ * is critical the we not allow the compiler to inline this function in to
+ * dbuf_sync_list() thereby drastically bloating the stack usage.
+ */
+noinline static void
 dbuf_sync_indirect(dbuf_dirty_record_t *dr, dmu_tx_t *tx)
 {
 	dmu_buf_impl_t *db = dr->dr_dbuf;
@@ -3148,7 +3153,12 @@ dbuf_sync_indirect(dbuf_dirty_record_t *dr, dmu_tx_t *
 	zio_nowait(zio);
 }
 
-static void
+/*
+ * dbuf_sync_leaf() is called recursively from dbuf_sync_list() so it is
+ * critical the we not allow the compiler to inline this function in to
+ * dbuf_sync_list() thereby drastically bloating the stack usage.
+ */
+noinline static void
 dbuf_sync_leaf(dbuf_dirty_record_t *dr, dmu_tx_t *tx)
 {
 	arc_buf_t **datap = &dr->dt.dl.dr_data;

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c	Sun Aug 12 01:17:32 2018	(r337671)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c	Sun Aug 12 01:29:30 2018	(r337672)
@@ -2002,7 +2002,7 @@ receive_read(struct receive_arg *ra, int len, void *bu
 	return (0);
 }
 
-static void
+noinline static void
 byteswap_record(dmu_replay_record_t *drr)
 {
 #define	DO64(X) (drr->drr_u.X = BSWAP_64(drr->drr_u.X))
@@ -2137,7 +2137,7 @@ save_resume_state(struct receive_writer_arg *rwa,
 	rwa->os->os_dsl_dataset->ds_resume_bytes[txgoff] = rwa->bytes_read;
 }
 
-static int
+noinline static int
 receive_object(struct receive_writer_arg *rwa, struct drr_object *drro,
     void *data)
 {
@@ -2243,7 +2243,7 @@ receive_object(struct receive_writer_arg *rwa, struct 
 }
 
 /* ARGSUSED */
-static int
+noinline static int
 receive_freeobjects(struct receive_writer_arg *rwa,
     struct drr_freeobjects *drrfo)
 {
@@ -2279,7 +2279,7 @@ receive_freeobjects(struct receive_writer_arg *rwa,
 	return (0);
 }
 
-static int
+noinline static int
 receive_write(struct receive_writer_arg *rwa, struct drr_write *drrw,
     arc_buf_t *abuf)
 {
@@ -2309,7 +2309,6 @@ receive_write(struct receive_writer_arg *rwa, struct d
 		return (SET_ERROR(EINVAL));
 
 	tx = dmu_tx_create(rwa->os);
-
 	dmu_tx_hold_write(tx, drrw->drr_object,
 	    drrw->drr_offset, drrw->drr_logical_size);
 	err = dmu_tx_assign(tx, TXG_WAIT);
@@ -2500,7 +2499,7 @@ receive_spill(struct receive_writer_arg *rwa, struct d
 }
 
 /* ARGSUSED */
-static int
+noinline static int
 receive_free(struct receive_writer_arg *rwa, struct drr_free *drrf)
 {
 	int err;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808120129.w7C1TUAj098097>