public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: George Spelvin <lkml@sdf.org>
Cc: st5pub@yandex.ru, adrian.hunter@intel.com,
	ard.biesheuvel@linaro.org, benh@kernel.crashing.org,
	bp@alien8.de, darrick.wong@oracle.com, dchinner@redhat.com,
	dedekind1@gmail.com, gregkh@linuxfoundation.org, hpa@zytor.com,
	jannh@google.com, jlbec@evilplan.org, jpoimboe@redhat.com,
	jslaby@suse.cz, linux-kernel@vger.kernel.org,
	linux-mtd@lists.infradead.org,
	linux-snps-arc@lists.infradead.org,
	linuxppc-dev@lists.ozlabs.org, mark@fasheh.com, mingo@redhat.com,
	mpe@ellerman.id.au, naveen.n.rao@linux.vnet.ibm.com,
	ocfs2-devel@oss.oracle.com, paulus@samba.org,
	peterz@infradead.org, richard@nod.at, sfr@canb.auug.org.au,
	tglx@linutronix.de, vgupta@synopsys.com, x86@kernel.org
Subject: Re: [PATCH v2 5/5] Lib: sort.h: replace int size with size_t size in the swap function
Date: Mon, 1 Apr 2019 13:28:06 +0300	[thread overview]
Message-ID: <20190401102806.GE9224@smile.fi.intel.com> (raw)
In-Reply-To: <201904010956.x319u70q021113@sdf.org>

On Mon, Apr 01, 2019 at 09:56:07AM +0000, George Spelvin wrote:
> On Mon, 1 Apr 2019 at 12:35:55 +0300, Andy Shevchenko wrote:
> > Hmm... If (*swap)() is called recursively it means the change might increase
> > stack usage on 64-bit platforms.
> > 
> > Am I missing something?
> 
> Under what conceivable circumstance would someone write a recursive
> (*swap)() function?
> 
> You're technically right, but the precondition is more fantastical
> than "if the U.K.'s parliament get their shit together before the
> 12th", so I have a hard time worrying about it.
> 
> But you did make me think of something: the whole reason swap()
> takes a size argument is for the benefit of the (no longer existing)
> generic swap functions.  All of the custom swap functions ignore
> it.
> 
> So how about *deleting* the parameter instead?  That simplifies
> everything.

I like this idea!

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2019-04-01 10:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <19606671554056883@myt3-1179f584969c.qloud-c.yandex.net>
2019-04-01  9:25 ` [PATCH v2 0/5] simple sort swap function improvements Andy Shevchenko
     [not found] ` <23051461554058370@iva6-3ac3de5fcc31.qloud-c.yandex.net>
2019-04-01  9:35   ` [PATCH v2 5/5] Lib: sort.h: replace int size with size_t size in the swap function Andy Shevchenko
2019-04-01  9:56     ` George Spelvin
2019-04-01 10:28       ` Andy Shevchenko [this message]
     [not found] ` <14019281554057359@sas1-87f9feb8d943.qloud-c.yandex.net>
2019-04-01 11:08   ` [PATCH v2 2/5] powerpc: module_[32|64].c: replace swap function with built-in one Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190401102806.GE9224@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=adrian.hunter@intel.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=benh@kernel.crashing.org \
    --cc=bp@alien8.de \
    --cc=darrick.wong@oracle.com \
    --cc=dchinner@redhat.com \
    --cc=dedekind1@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=jannh@google.com \
    --cc=jlbec@evilplan.org \
    --cc=jpoimboe@redhat.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lkml@sdf.org \
    --cc=mark@fasheh.com \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=richard@nod.at \
    --cc=sfr@canb.auug.org.au \
    --cc=st5pub@yandex.ru \
    --cc=tglx@linutronix.de \
    --cc=vgupta@synopsys.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox