1. Short title This Act may be cited as the Retirement Security Preservation Act of 2017 . 2. Modification of nondiscrimination rules to protect older, longer service participants (a) In general Section 401 of the Internal Revenue Code of 1986 is amended— (1) by redesignating subsection (o) as subsection (p), and (2) by inserting after subsection (n) the following new subsection: (o) Special rules for applying nondiscrimination rules To protect older, longer service and grandfathered participants (1) Testing of defined benefit plans with closed classes of participants (A) Benefits, rights, or features provided to closed classes A defined benefit plan which provides benefits, rights, or features to a closed class of participants shall not fail to satisfy the requirements of subsection (a)(4) by reason of the composition of such closed class or the benefits, rights, or features provided to such closed class, if— (i) for the plan year as of which the class closes and the 2 succeeding plan years, such benefits, rights, and features satisfy the requirements of subsection (a)(4) (without regard to this subparagraph but taking into account the rules of subparagraph (I)), (ii) after the date as of which the class was closed, any plan amendment which modifies the closed class or the benefits, rights, and features provided to such closed class does not discriminate significantly in favor of highly compensated employees (determined as of the effective date of the amendment), and (iii) the class was closed before April 5, 2017, or the plan is described in subparagraph (C). (B) Aggregate testing with defined contribution plans permitted on a benefits basis (i) In general For purposes of determining compliance with subsection (a)(4) and section 410(b), a defined benefit plan described in clause (iii) may be aggregated and tested on a benefits basis with 1 or more defined contribution plans, including with the portion of 1 or more defined contribution plans which— (I) provides matching contributions (as defined in subsection